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

retriedResults undefined #182

Open
MichalNemec opened this issue Nov 29, 2022 · 1 comment
Open

retriedResults undefined #182

MichalNemec opened this issue Nov 29, 2022 · 1 comment

Comments

@MichalNemec
Copy link

Hello, im trying to send notifications to device group (it works), it worked when i passed in just a device token

const settings = {
    gcm: {
      id: "...",
      phonegap: false,
    },
    isAlwaysUseFCM: true,
  };
  const push = new PushNotifications(settings);

  const deviceGroups = [];
  deviceGroups.push(
    "..."
  );
  
  push.send(deviceGroups, data, (err, result) => {
    if (err) {
      console.log(err);
      res.status(500).send(JSON.stringify(err, null, 2));
    } else {
      console.log(result[0].message);
      res.status(200).send(`ok`);
    }
  });
{
    "data": {
        "message": "Bad Gateway"
    },
    "type": "client_error",
    "version": "2"
}


/opt/project/functions/node_modules/node-gcm/lib/sender.js:125
        results[regTokenPositionMap[i]] = retriedResults[i];
                                          ^

TypeError: Cannot read properties of undefined (reading '0')
    at updateResults (/opt/project/functions/node_modules/node-gcm/lib/sender.js:125:43)
    at updateResponse (/opt/project/functions/node_modules/node-gcm/lib/sender.js:118:5)
    at <anonymous> (/opt/project/functions/node_modules/node-gcm/lib/sender.js:64:28)
    at Request._callback (/opt/project/functions/node_modules/node-gcm/lib/sender.js:178:13)
    at Request.self.callback (/opt/project/functions/node_modules/request/request.js:185:22)
    at Request.emit (node:events:513:28)
    at Request.emit (node:domain:489:12)
    at Request.<anonymous> (/opt/project/functions/node_modules/request/request.js:1154:10)
    at Request.emit (node:events:513:28)
    at Request.emit (node:domain:489:12)
@alex-friedl
Copy link
Collaborator

@MichalNemec Sorry for not getting to this earlier. Is this still an issue? Seems like it should be fixed in node-gcm, if it hasn't in the meantime?

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

No branches or pull requests

2 participants