Expo push notification with firebase cloud function

#1

Hello,

I need to send push notification with expo and firebase clouud function because of I m using firebase database.
it will triggered and send push when there is any update on firebase database. is there any solution for this issue???

firebase cloud function is not support (async functions) so ı could not use the “await …” type for exponent-server-sdk. how can I handle it?

Thank you…

1 Like
#2

is there anybody to answer and be hero:))

1 Like
#3

you could use OneSignal and call it from firebase function

btw cloud functions was down the past day. It’s back up now

#4

How can I use onesignal with expoPushToken? or should I use only onesignal??

#5

Sorry i’m using OneSignal because we ejected/detached so we couldn’t use expo push tokens.
I never implemented expo push token…

#6

Don’t think you can do that.

I had this same question last week and decided to detach from Expo for the sake of FCM.

1 Like
#7

Hi,

did you handle it? is there any problem on detaching from expo?

#8

@suatozkan While firebase cloud messaging cannot be used in the regular expo configuration without detaching, I believe that firebase cloud functions are possible. Would using await + fetch work, perhaps as described in this medium article here: https://medium.com/step-up-labs/our-experience-with-cloud-functions-for-firebase-d206448a8850 ?

There have also been accounts of Expo users getting firebase cloud functions working in this thread here: Expo and uploading image Blobs?

1 Like
#9

I use ZetPush https://zetpush.com/ for web notifications. Is very easy to use.

#10

I’m interested in a solution to this as well. It seems like I should be able to just write a cloud function that uses the ExpoClient described in their node documentation however when I try to do that, it doesn’t seem to work. Perhaps it’s because I’m not installing the expo-client-sdk correctly? I’m still new to firebase so if that’s the case, I’ll need another solution to handle push notifications.

#11

Hey @fourcolors,

Are you on a paid plan for Firebase? The free plan only allows for outbound network requests to Google-owned services. In order to use the expo node server, you’ll have to be on a paid plan.

Cheers,

Adam

#12

So it looks like my issue was I was importing is incorrectly. I was following the import syntax for the docs but that didn’t work on firebase, I had to do something like import * as Expo from 'expo-server-sdk'

3 Likes
#13

Legend! I was having the same issue. I think this will help a lot of people.

1 Like
#14

I’ve got a tutorial on using cloud functions with expo push notifications. : https://www.youtube.com/watch?v=R2D6J10fhA4&t=1s
Hope it helps!

#15

I used your tutorial and everything works. but i keep getting this error in the cloud function. its firing off and im getting the data etc. but its not doing the route correctly.

#16

Is this perhaps because you haven’t switched to the Blaze plan to support outbound requests?