Skip to content

Not initializing correctly #21

@jcguarinpenaranda

Description

@jcguarinpenaranda

Hello,

I am trying to use your package but it tells me "Trying to initialize OneSignalPushAdapter without oneSignalAppId or oneSignalApiKey"

I copied and pasted the example shown at the README.md.

That said, I have been trying to debug the package putting a console.log() when it initializes.

Here is what I am doing:

var OneSignalPushAdapter = exports.OneSignalPushAdapter = function () {
  function OneSignalPushAdapter() {
    var pushConfig = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];

    // I am adding this line
    console.log("pushConfig", pushConfig) 

    //.....

Now, I am testing the code like this:

var OneSignalPushAdapter = require('parse-server-onesignal-push-adapter');

var oneSignalPushAdapter = new OneSignalPushAdapter({
  oneSignalApiKey: "123",
  oneSignalAppId: "123"
});

When this piece of code executes, I see in the console that OneSignalPushAdapter tries to be initialized 3 times. (i don't know why)

The console.log result i am getting is:

pushConfig { oneSignalApiKey: '123', oneSignalAppId: '123' }
pushConfig { adapter: [Function: OneSignalPushAdapter] }
pushConfig { adapter: [Function: OneSignalPushAdapter] }

/home/jcguarinpenaranda/workspace/myapp/node_modules/parse-server-onesignal-push-adapter/lib/OneSignalPushAdapter.js:41
      throw "Trying to initialize OneSignalPushAdapter without oneSignalAppId or oneSignalApiKey";
      ^
Trying to initialize OneSignalPushAdapter without oneSignalAppId or oneSignalApiKey

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions