Open bensebborn opened 1 year ago
Hey @bensebborn. Thanks for reaching out, we are sorry that you are having problems with this SDK.
Do you use the latest version 2.0.1-beta2? We recently added 400 error handlers to all our endpoints
While it may not fix the problem, it should at least show the error coming from the server.
I'll create an internal ticket to investigate this problem.
Meanwhile, if you are blocked by this issue you can always use this endpoints manually, making any type of HTTP requests (CURL, java script fetch etc.) https://documentation.onesignal.com/reference/create-notification
Hi there,
Thanks for the reply :)
I noticed in the commits that the error handler had been removed from -beta2.
I've just downgraded to -beta1 and I can now see the correct error message. Thanks!
Do you use the latest version 2.0.1-beta2? We recently added 400 error handlers to all our endpoints
While it may not fix the problem, it should at least show the error coming from the server.
I don't understand that reply. Are you saying that using 2.0.1-beta2
helps diagnose the problem because it has added error handlers? I am not finding that to be the case using that version. I am trying a simple notification using a template and I just get
✖ Error: HTTP-Code: 400
Message: Bad Request
Body: {"errors":[{}]}
@bensebborn says he downgraded to get a useful error message? Is that the expected approach?
I am trying something very simple:
const notification = new OneSignal.Notification()
notification.app_id = appId
notification.template_id = 'redacted'
notification.custom_data = {
...redacted
}
notification.include_external_user_ids = ['redacted'] // This is deprecated but
// include_aliases: { onesignal_id: [redacted'] }, // the recommended approach is not possible
await client.createNotification(notification)
Pinning to version 2.0.1-beta1
meant I was able to get meaningful error messages again.
I find this worrying given that I am evaluating OneSignal with a view to purchasing a licence. It seems that this particular SDK is not keeping up with the API - and is breaking fundamental things with new releases? :(
Same here, I had to downgrade to 2.0.1-beta1
otherwise the response body would just be r { errors: [ r {}, r {}, r {} ] }
.
It's crazy that this has still not been sorted. Frustrated me all night until I came here to see this
It's been recommended to me (by OneSignal) to use the REST API directly using any http client and to not use this particular SDK
What happened?
Sending notification using "included_segments" works, however swapping this to use "include_subscription_ids" fails with a 400 error with no meaningful error message
Steps to reproduce?
What did you expect to happen?
Notification sent
Relevant log output
Code of Conduct