I have tried sending 404 status using json-server and it works with postman as seen below.
But when I’m doing it inside apollo sandbox, it’s giving me this invalid doctype. Not sure why json-server is sending out html instead of json content type because I’ve already set it
I tried casting the error to ApolloError but to no avail
throw new ApolloError('InputValidationError', 'INVALID_INPUT', { error });
What am I missing?
1 Answer
Forgot to add error formatting in the server. Refer to https://www.apollographql.com/docs/apollo-server/v2/data/errors/#masking-and-logging-errors
formatError: (err) => { return err; },
0