apollo-errors icon indicating copy to clipboard operation
apollo-errors copied to clipboard

Message not propagating in 1.7.1

Open prperrino opened this issue 7 years ago • 18 comments

Changes between versions 1.5.1 and 1.7.1 appear to have broken the message field propagation when using createError:

const myError = createError('BadError', { message: "This is bad"}); var theError = new myError(); console.log(theError.message)

output of message field is undefined....

Works great in 1.5.1, broken in 1.7.1

prperrino avatar Feb 26 '18 16:02 prperrino

I am seeing the same thing. I don't know enough about the history and/or reasoning to use arguments[2] in the ApolloError constructor (instead of using the config variable) to put in a PR for it, but there are only 2 args in the arguments array when I through and the relevant data is in config / arguments[1].

I haven't tried v 1.5.1 myself, but by tweaking that argument reference it works as expected for me.

azterix avatar Feb 26 '18 18:02 azterix

Thanks! I'll try to submit a fix for this later tonight

thebigredgeek avatar Feb 26 '18 19:02 thebigredgeek

Somehow this only happens if I run it in production mode, locally it works?

Ponjimon avatar Mar 01 '18 12:03 Ponjimon

Please, fix this )

groundmuffin avatar Mar 02 '18 15:03 groundmuffin

I am attempting to throw an error inside of a resolver by doing throwing an error created using apollo-errors

const UserDoesntExistError = createError("UserDoesntExist", {
  message: "A user with this email address does not exist",
})
...
if (!user) throw new UserDoesntExistError()

On the frontend when this error occurs, the message is not displayed.

image

Connorelsea avatar Mar 05 '18 03:03 Connorelsea

Any update on this? I had to downgrade to 1.5.1 😞

lobodart avatar Mar 06 '18 15:03 lobodart

bump

joshmanders avatar Mar 11 '18 19:03 joshmanders

Any updates on this?

dakshshah96 avatar Mar 17 '18 13:03 dakshshah96

just created a simple pull request: #32

luisgrases avatar Mar 17 '18 20:03 luisgrases

My pull request still doesn't fix all issues so it is better to just use 1.5.1

luisgrases avatar Mar 18 '18 17:03 luisgrases

#29 should also fix this issue

ecwyne avatar Mar 18 '18 21:03 ecwyne

i actually lost sleep because of this issue :)

groundmuffin avatar Apr 04 '18 18:04 groundmuffin

A fix for this should be live in 1.8.0. Can anyone here confirm?

thebigredgeek avatar Apr 11 '18 04:04 thebigredgeek

@thebigredgeek confirmed it works.

joshmanders avatar Apr 11 '18 12:04 joshmanders

@thebigredgeek missing again in 1.9 plz reopen it

ash0080 avatar Jul 24 '18 23:07 ash0080

@theGlenn I thought we had a test case for this. confused haha

thebigredgeek avatar Jul 25 '18 08:07 thebigredgeek

I'm also facing this issue. It only seems to happen in production for me. Locally everything works fine.

pcorey avatar Aug 17 '18 21:08 pcorey

@theGlenn did you have a chance to test for this?

thebigredgeek avatar Aug 06 '19 18:08 thebigredgeek