Hey folks,
So I’ve been battling trying to get notifications to work with my Expo project for over a week now, and I’m still not quite there. I’ve managed to get notifications working with the Expo app on local development, but once the app is deployed to TestFlight, notifications are no longer received and a generic error message is returned.
I’m using the following setup:
- App is NOT ejected, it’s built with
create-react-native-app
and is still handled by Expo (deploy script listed towards the end) - Uses simple Node.js notifications script (basically this: GitHub - expo/expo-server-sdk-node: Server-side library for working with Expo using Node.js)
- Using expo-server-sdk (GitHub - expo/expo-server-sdk-node: Server-side library for working with Expo using Node.js)
- Pushing notifications with
expo.sendPushNotificationsAsync(chunk)
- Then checking the receipts with
expo.getPushNotificationReceiptsAsync(chunk)
When attempting to notify any token that correspond to TestFlight installs, I get the following error message:
'[hash-of-receipt-id]':
{ status: 'error',
message:
'The Apple Push Notification service unexpectedly dropped the connection. Retry sending the notification later.',
details: { sentAt: 1535131662 },
__debug: { internalError: 'stream ended unexpectedly' } }
I do not get this error message developing locally with the Expo app.
I’m using the code from the example on the Node expo-server-sdk
docs here for reference: GitHub - expo/expo-server-sdk-node: Server-side library for working with Expo using Node.js.
Just to re-iterate, I believe the script itself is fine, as it triggers notifications for Expo (local dev server on my mac) but fails when the app is installed via TestFlight (we’re still in testing so haven’t progressed to an app listing on the App Store yet, so can’t comment on if the issue persists there too).
Outside of the notifications script (which I don’t think is the source of the problem but may be wrong), my deploy script is based on this post on the Expo blog: Automating Standalone Expo App Builds and Deployments with Fastlane and Expo CLI | by Mark Glagola | Exposition
So I think that should deploy to TestFlight in the manner Expo expects (which makes me wonder where the issue really is?). Might I have missed a key step to get app’s distributed with TestFlight working? I’ve not seen that in the docs if so.
Worth noting, I have tweaked a few things in Xcode as I tried to get OneSignal working before I realised that wasn’t possible without ejecting. This is my first mobile app project so I’m naive when it comes to what might be the cause of this problem.
Any help or direction to proceed here would be much appreciated as I’m at the point where I might recreate a whole new project and go through the process of submitting to Apple again just to see if a fresh build would work, but that would be a fair amount of hassle.
If you read this far, thanks
EDIT: Someone mentioned it might be a certificate problem. Does that sound right? Will investigate that, but please let me know if you have thoughts about other potential causes here!