Sending Apple Push notification within an Edge function
Does someone already tried sending push notification through Apple Push Notification Service with an Edge function?
Unfortunately I can't do it because can't solve the problem around the authentication cert file. I already tried to store the content in a variable both inside the function's code and also in an environment variable, but I always get an error (Error: secretOrPrivateKey is not valid key material). I also tried to read the p8 file directly from the disk but in that case I get a file system access error.
8 Replies
Did you find a solution for this? Looking for how to handle APN within Supabase as well.
@Joe Unfortunately not really so I created a webapp that subscribes to supabase db changes and handle the push notification sending
Bummer. Guess I’ll look at spinning up a Firebase project to handle APN then.
https://www.youtube.com/watch?v=CiSv9E6ZKVc
Recent Supabase video handling Push with flutter with edge functions, I think there would be some crossover here with what you need to do.
Supabase
YouTube
How to send push notifications to your Flutter apps using Supabase ...
Push notifications are an essential part of mobile app development. In this video, Tyler will takes us through how to use FCM with Supabase to send push notifications to your Flutter apps. The app will work by first inserting a new row into the database, which triggers a database web hook, which calls an edge function. The edge function then cal...
Thanks! This was helpful for putting parts of this together. Helped to clarify that there's no avoiding FCM for now.
Though, I'm running into issues with the edge function from the docs (https://supabase.com/docs/guides/functions/examples/push-notifications?platform=fcm) which is returning the following errors when its deployed and is triggered. Anyone run into this when going through the docs/video as well?
Error: Not implemented: crypto.Sign
at notImplemented (https://deno.land/std@0.177.1/node/_utils.ts:6:9)
at new Sign (https://deno.land/std@0.177.1/node/internal/crypto/sig.ts:10:5)
at Object.createSign (https://deno.land/std@0.177.1/node/crypto.ts:41:10)
at Object.sign (https://esm.sh/v135/jwa@2.0.0/deno/jwa.mjs:10:1429)
at Object.B [as sign] (https://esm.sh/v135/jws@4.0.0/deno/jws.mjs:16:2178)
at T.requestToken (https://esm.sh/v135/gtoken@7.0.1/deno/gtoken.mjs:8:4404)
at T.getTokenAsyncInner (https://esm.sh/v135/gtoken@7.0.1/deno/gtoken.mjs:8:3391)
at T.getTokenAsync (https://esm.sh/v135/gtoken@7.0.1/deno/gtoken.mjs:8:2968)
at T.getToken (https://esm.sh/v135/gtoken@7.0.1/deno/gtoken.mjs:8:2117)
at i.refreshTokenNoCache (https://esm.sh/v135/google-auth-library@9.4.1/deno/google-auth-library.mjs:37:23973)
Sending Push Notifications | Supabase Docs
Send Push Notifications to your React Native iOS and Android apps using Expo.
Looks like I needed to update my supabase CLI and that resolved the errors
Yes unfortunately FCM is non-negotiable, don't like it at all
Not fully up to speed but seems it is being clamped down further... https://news.ycombinator.com/item?id=36433699
diazc
Ask HN: Alternative to Firebase FCM
This is the message I received from Firebase on FCM deprecation:"We’re writing to let you know that starting June 20, 2024 the legacy Firebase Cloud Messaging (FCM) APIs will be discontinued.What do you need to know?On June 20, 2024, we’re reducing the number of Firebase Cloud Messaging (FCM) legacy register APIs and legacy send APIs that provid...
Hacker News