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

[Bug]: createNotification does not work #49

Open
1 task done
YohaanYoon opened this issue Jan 20, 2023 · 2 comments
Open
1 task done

[Bug]: createNotification does not work #49

YohaanYoon opened this issue Jan 20, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@YohaanYoon
Copy link

What happened?

  • createNotification does not work.
  • I guess the reason of error is as follows:

Steps to reproduce?

1. install 1.0.0beta9
2. setting configuration
3. run createNotification
4. not working

What did you expect to happen?

works normally, and sent push message

Relevant log output

{"errors":["Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> or Bearer token=\"<YOUR-REST-API-KEY-HERE>\" with a valid REST API key."]}
Headers: {"access-control-allow-headers":"SDK-Version","access-control-allow-origin":"*","alt-svc":"h3=\":443\"; ma=86400, h3-29=\":443\"; ma=86400","cache-control":"no-cache","cf-cache-status":"DYNAMIC","cf-ray":"78c4f54cec66a7e3-ICN","connection":"close","content-type":"application/json; charset=utf-8","date":"Fri, 20 Jan 2023 04:10:03 GMT","referrer-policy":"strict-origin-when-cross-origin","server":"cloudflare","status":"400 Bad Request","strict-transport-security":"max-age=15552000; includeSubDomains","transfer-encoding":"chunked","vary":"Origin","via":"1.1 google","x-content-type-options":"nosniff","x-download-options":"noopen","x-frame-options":"SAMEORIGIN","x-permitted-cross-domain-policies":"none","x-request-id":"b0fc6853-25f3-4ea5-92f7-2ecd96f711eb","x-runtime":"0.005988","x-xss-protection":"1; mode=block"}
    at new ApiException (/Users/yohaanyoon/classting/classting-push-service/node_modules/@onesignal/node-onesignal/dist/apis/exception.js:22:28)
    at DefaultApiResponseProcessor.<anonymous> (/Users/yohaanyoon/classting/classting-push-service/node_modules/@onesignal/node-onesignal/dist/apis/DefaultApi.js:1707:31)
    at step (/Users/yohaanyoon/classting/classting-push-service/node_modules/@onesignal/node-onesignal/dist/apis/DefaultApi.js:48:23)
    at Object.next (/Users/yohaanyoon/classting/classting-push-service/node_modules/@onesignal/node-onesignal/dist/apis/DefaultApi.js:29:53)
    at fulfilled (/Users/yohaanyoon/classting/classting-push-service/node_modules/@onesignal/node-onesignal/dist/apis/DefaultApi.js:20:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 400,
  body: BadRequestError {
    errors: [
      'Please include a case-sensitive header of Authorization: Basic <YOUR-REST-API-KEY-HERE> or Bearer token="<YOUR-REST-API-KEY-HERE>" with a valid REST API key.'
    ]
  },
  headers: {
    'access-control-allow-headers': 'SDK-Version',
    'access-control-allow-origin': '*',
    'alt-svc': 'h3=":443"; ma=86400, h3-29=":443"; ma=86400',
    'cache-control': 'no-cache',
    'cf-cache-status': 'DYNAMIC',
    'cf-ray': '78c4f54cec66a7e3-ICN',
    connection: 'close',
    'content-type': 'application/json; charset=utf-8',
    date: 'Fri, 20 Jan 2023 04:10:03 GMT',
    'referrer-policy': 'strict-origin-when-cross-origin',
    server: 'cloudflare',
    status: '400 Bad Request',
    'strict-transport-security': 'max-age=15552000; includeSubDomains',
    'transfer-encoding': 'chunked',
    vary: 'Origin',
    via: '1.1 google',
    'x-content-type-options': 'nosniff',
    'x-download-options': 'noopen',
    'x-frame-options': 'SAMEORIGIN',
    'x-permitted-cross-domain-policies': 'none',
    'x-request-id': 'b0fc6853-25f3-4ea5-92f7-2ecd96f711eb',
    'x-runtime': '0.005988',
    'x-xss-protection': '1; mode=block'
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@YohaanYoon YohaanYoon added the bug Something isn't working label Jan 20, 2023
@iAmWillShepherd
Copy link

@YohaanYoon, can you clarify if this is an issue with creating notifications or if it was more of a user error due to incorrect authentication? I'm running into an issue where this function actually doesn't work regardless if authentication is correct.

@hlhdaiaaii
Copy link

hlhdaiaaii commented Jun 14, 2023

in my case, calling client.createNotification() and specifying included_segments causes this error whereas sending to specific ids through include_player_ids works well.

thank @YohaanYoon for pointing the workaround, swapping these two appKey and userKey value fixes the problem.

i am using version 2.0.0-beta1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants