FetchError (server side) when pushing notification on expo


#1

I am trying to send push notifications using the expo-server-sdk-node package from a firebase cloud function.
the server returns a fetchError : getaddrinfo EAI_AGAIN exp.host:443

The rest of the function executes with no error.
The expo token and message format seem correct (see actual behavior).

I use :

let chunk = expo.chunkPushNotifications(messages);
let ticketChunk = await expo.sendPushNotificationsAsync(chunk);

The message object sent is :

[ { to: 'ExponentPushToken[wpZZfVOYDjb8Xq_jmNOXGI]',
    sound: 'default',
    body: 'jkObject wrote : Hello World!',
    title: 'New Message on PiPle' } ]

The ticketChunk gets this error :

{ FetchError: request to https://exp.host/--/api/v2/push/send failed, reason: getaddrinfo EAI_AGAIN exp.host:443
    at ClientRequest.<anonymous> (/srv/node_modules/node-fetch/lib/index.js:1345:11)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at TLSSocket.socketErrorListener (_http_client.js:387:9)
    at emitOne (events.js:116:13)
    at TLSSocket.emit (events.js:211:7)
    at emitErrorNT (internal/streams/destroy.js:64:8)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
  message: 'request to https://exp.host/--/api/v2/push/send failed, reason: getaddrinfo EAI_AGAIN exp.host:443',
  type: 'system',
  errno: 'EAI_AGAIN',
  code: 'EAI_AGAIN' }

#2

Hey @lamipaul,

Just to make sure, are you on a paid firebase plan? You can only make outbound requests if you are on a paid plan.

Cheers,

Adam


#3

No I am on a free plan…That explains a lot thanks a lot for your answer.

Should I just send the notifications from the client app then ? or is there a better solution ?


#4

That is certainly an option and the other alternative is upgrading your Firebase plan.


closed #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.