parcelvoy/platform

Failed to parse private key: Error: Invalid PEM formatted message.

Closed this issue · 2 comments

Hi, after upgrading to the version 1.7.0 and configuring the APN/Firebase provider, I reproduce an error reported on sentry after launching a campaign:

Failed to parse private key: Error: Invalid PEM formatted message.

/usr/src/app/build/providers/push/LocalPushProvider.js in LocalPushProvider.send at line 101:47

            apn: this.apn,
            fcm: this.fcm,
        }); // Types are not up to date
    }
    async send(push) {
        // TODO: Need a better way of bubbling up errors
        const { tokens, title, body, custom } = push;
-->     const response = await this.transport.send(typeof tokens === 'string' ? [tokens] : tokens, {
            title,
            topic: this.apn?.bundleId,
            body,
            custom,
        });
        const invalidTokens = [];
        for (const method of response) {

The FCM provider fields seem OK. I tried to modify the private key content without success.

Just to see if my hunch is correct, can you try replacing new lines inside of your key with \n I wonder if somewhere along the process its not properly reading the PEM file

Just to see if my hunch is correct, can you try replacing new lines inside of your key with \n I wonder if somewhere along the process its not properly reading the PEM file

@pushchris I tried both, by default in the JSON payload, there are \n characters. I removed them but it didn't work