Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEBUG=node-gcm seems to not be working properly? #65

Closed
bigthyme opened this issue Oct 30, 2014 · 8 comments · Fixed by #86
Closed

DEBUG=node-gcm seems to not be working properly? #65

bigthyme opened this issue Oct 30, 2014 · 8 comments · Fixed by #86
Milestone

Comments

@bigthyme
Copy link

I'm on node-gcm latest version and setting the DEBUG flag as a bash variable yields nothing out of the ordinary. Is there something else I need to do asides from setting this flag and installing the npm Debug module?

@rahatm1
Copy link

rahatm1 commented Nov 27, 2014

having same issue here.

@hypesystem
Copy link
Collaborator

This works for me. What exactly are you typing into the console?

@hypesystem
Copy link
Collaborator

This is what I get:

$ DEBUG=node-gcm ./node_modules/.bin/mocha -R spec test/**/*Spec.js


  UNIT Message
    constructor
      V should create an empty message with a data object if not passed an object
      V should call new on constructor if user does not
      V should create an message with properties passed in
      V should only set properties passed into constructor
    addData()
      V should be the same as addDataWithKeyValue
      V should add properties to the message data object given a key and value
      V should only set values on data object, not top level message
      - should do something if not called properly
    addDataWithObject()
      V should set the data property to the object passed in
      V should overwrite data object when an object is passed in
      V should not overwrite data if not passed an object
      V should not overwrite data if passed an empty object

  UNIT Sender
    constructor
      V should call new on constructor if user does not
      V should create a Sender with key and options passed in
      - should do something if not passed a valid key
    sendNoRetry()
      V should set proxy, maxSockets, and/or timeout of req object if passed into constructor
      V should set the API key of req object if passed in API key
      V should stringify body of req before it is sent
      V should set properties of body with message properties
      V should set the registration ids to reg ids passed in
      V should pass an error into callback if request returns an error
      V should pass an error into callback if response does not exist
  node-gcm GCM service is unavailable (500) +0ms
      V should return the status code as an error if returned a 500
  node-gcm Unauthorized (401). Check that your API token is correct. +0ms
      V should return the status code as an error if returned a 401
  node-gcm Invalid request (400): [object Object] +15ms
      V should return the status code as an error if returned a 400
  node-gcm Error handling GCM response SyntaxError: Unexpected token o +0ms
      V should pass an error into the callback if resBody cannot be parsed
      V should pass in parsed resBody into callback on success
    send()
      - should do something if passed not an array for regIds
  node-gcm No RegistrationIds given! +16ms
      V should pass an error into callback if array has no regIds
Firing send
      V should pass the message and the regId to sendNoRetry on call
Firing send
      V should pass the message and the regIds to sendNoRetry on call
Firing send
      V should pass the result into callback if successful for id
Firing send
      V should pass the result into callback if successful for ids
Firing send
      V should pass the error into callback if failure and no retry for id
Firing send
      V should pass the error into callback if failure and no retry for ids
Firing send
Firing send
      V should retry number of times passed into call and do exponential backoff (1014ms)
Firing send
  node-gcm Results received but not all successful +1s { results: [ {}, {}, { error: 'Unavailable' } ] }
Firing send
      V should retry if not all regIds were successfully sent (1001ms)
Firing send
Firing send
      V should retry all regIds in event of an error (1000ms)


  35 passing (3s)
  3 pending

Lines like the following are only produced when DEBUG=node-gcm is set:

node-gcm Unauthorized (401). Check that your API token is correct. +0ms

@bigthyme
Copy link
Author

I'm just adding the following line to my code and no new log items are showing.

process.env.DEBUG = 'node-gcm';

@hypesystem
Copy link
Collaborator

It works when calling it as shown above, by including the flag in the command you use to run you app.

DEBUG=node-gcm node app.js

I will look into setting the flag in code (and whether this is possible), but I generally wouldn't recommend always running with debug mode on :)

@hypesystem
Copy link
Collaborator

(Oops. Accidental close.)

@hypesystem
Copy link
Collaborator

It should probably be clarified in the README how to actually use the DEBUG flag

@hypesystem hypesystem added this to the v0.9.14 milestone Jan 23, 2015
@hypesystem
Copy link
Collaborator

The issue of setting the flag programatically should probably be taken over to the debug repository's issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants