node-gcm icon indicating copy to clipboard operation
node-gcm copied to clipboard

TypeError: Assignment to constant variable.

Open brunolemos opened this issue 8 years ago • 6 comments

Happening when using x.sendNoRetry(message, { registrationTokens: [regToken] }, function (err, response) {

node-gcm v0.14.0 node v7.10.1

brunolemos avatar Sep 23 '17 01:09 brunolemos

Hi @brunolemos ,

Can you show us the exact error message? And could you maybe show us the lines around the sendNoRetry call?

Have you defined message as a const? Or anything else?

Inside node-gcm we don't use const anywhere, so I'm trying to determine where this comes from.

Thanks for taking the time to report this :-)

Best, Niels

hypesystem avatar Sep 23 '17 07:09 hypesystem

Also, apparently this error can happen when assigning something to a name used by a function (see https://github.com/babel/babel/issues/4166). Could this be the case anywhere in your code?

hypesystem avatar Sep 23 '17 07:09 hypesystem

Closing due to lack of response. Feel free to reopen if you are still experiencing this.

eladnava avatar Oct 05 '17 10:10 eladnava

The code was doing this two times: sender.sendNoRetry and newSender.sendNoRetry, using 2 different api keys (I think one was invalid/expired?). This is probably what was causing the issue, I removed the one with old api key and seems fine now.

brunolemos avatar Oct 05 '17 15:10 brunolemos

That seems a bit odd imo! Were they two separate senders? Their state shouldn't be constant afaik.

I would love to see a stack trace on this, or the code as it was when the error occurred :smile:

hypesystem avatar Oct 05 '17 15:10 hypesystem

(So we can figure out exactly what went wrong and get it fixed!)

hypesystem avatar Oct 05 '17 15:10 hypesystem