APNs integration issue

Hi all! I'm trying to send a push notification with APNs. I've set the provider configuration, the template and the subscriber's token but when I'm trying to send it I get the error you can see below which I'm not sure what it is. { "stack": "Error: Could not build push handler id: 638f1b1c79b266fa794fd3e5, error: VError: Failed to generate token: error:0909006C:PEM routines:get_name:no start line\n at PushFactory.getHandler (/usr/src/app/apps/api/dist/main.js:16142:19)\n at SendMessagePush.<anonymous> (/usr/src/app/apps/api/dist/main.js:16089:54)\n at Generator.next (<anonymous>)\n at fulfilled (/usr/src/app/apps/api/dist/main.js:15948:58)\n at runMicrotasks (<anonymous>)\n at processTicksAndRejections (node:internal/process/task_queues:96:5)", "message": "Could not build push handler id: 638f1b1c79b266fa794fd3e5, error: VError: Failed to generate token: error:0909006C:PEM routines:get_name:no start line" } Do you have any idea about this? Thanks in advance!
14 Replies
empe
empe2y ago
@Support
serafeimo
serafeimo2y ago
FYI, 638f1b1c79b266fa794fd3e5 is my APNs provider and I'm pasting below its info: { "_id": "638f1b1c79b266fa794fd3e5", "_environmentId": "6388d19079b266fa794fa157", "_organizationId": "6388d19079b266fa794fa151", "providerId": "apns", "channel": "push", "credentials": { "secretKey": "-----BEGIN PRIVATE KEY----- my private key -----END PRIVATE KEY-----", "apiKey": "my api key", "projectName": "my team id" }, "active": true, "deleted": false, "createdAt": "2022-12-06T10:36:12.964Z", "updatedAt": "2022-12-21T10:35:45.265Z", "__v": 0 }
empe
empe2y ago
@Engineering
Dima Grossman
Dima Grossman2y ago
The APNS integration was submitted by community and is currently in beta, so unfortuently this error might happen due to lack of different setup testing performed. I'm personally not familiar with APNS a lot, but, @serafeimo are you familiar with this error message? Nonetheless, do you mind submitting an issue on GitHub for this? So we can track it there and try to find someone with APNS experience to help
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
serafeimo
serafeimo2y ago
I think I found something. When passing the "private key" from the dashboard it malforms it and then you get the above error. If you update APNS provider using the API and pass the key there, then it seems ok.
Dima Grossman
Dima Grossman2y ago
Hmmm, maybe it's encoded somehow?
serafeimo
serafeimo2y ago
It seems so. I think that when it parses the key from the user input in dashboard, It replaces \n with whitespaces
Novu_Bot
Novu_Bot2y ago
@serafeimo, you just advanced to level 2!
Pawan Jain
Pawan Jain2y ago
Hi @serafeimo Yes, it can be the cause of this error, Can you please create a bug on github? https://github.com/novuhq/novu/issues/new?assignees=&labels=type%3A+bug&template=bug_report.yml&title=%F0%9F%90%9B+Bug+Report%3A+
serafeimo
serafeimo2y ago
GitHub
🐛 Bug Report: APNS private key is not being parsed correctly · Iss...
📜 Description In APNS provider there is a field in order to set the private key. However, it seems that if someone copies the key and places it in that specific field, it&#39;s not getting pars...
Dima Grossman
Dima Grossman2y ago
@rolkool might be related! But I even think that we shouldn't rely on process.env.node_env but on user specified boolean for that. Because novu will always run in prod environment for all users @rolkool could you comment your findings on the GitHub issue please?
rolkool
rolkool2y ago
@dimagrossman I added a comment for the above