ToothlessGear / node-gcm

A NodeJS wrapper library port to send data to Android devices via Google Cloud Messaging
https://github.com/ToothlessGear/node-gcm
Other
1.3k stars 208 forks source link

TypeError: Assignment to constant variable. #308

Open brunolemos opened 6 years ago

brunolemos commented 6 years ago

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

node-gcm v0.14.0 node v7.10.1

hypesystem commented 6 years ago

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 commented 6 years ago

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?

eladnava commented 6 years ago

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

brunolemos commented 6 years ago

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.

hypesystem commented 6 years ago

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 commented 6 years ago

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