0

I am using Serverless framework to create lambda functions with node.js backend that uses fcm-push package.

Desired flow : Call api from mobile app -> api uses fcm-push package to send the payload/message/registration tokens to Firebase Cloud Messsaging -> sends push notification to Android and iOS devices

This works perfectly when I run the api locally using "serverless invoke local..."

However, when I do "serverless deploy" and hit the api endpoint from mobile app OR a rest client like Postman, the api call times out, i changed the timeout to 45 seconds and still times out. To troubleshoot, I removed all fcm related code from the api to see if api returns a response while hitting from mobile app/Postman. It does. So it seems like AWS is preventing the api to make a call to fcm, and the call lasts until it times out.

I am not sure what I can do to get around this as I am fairly new to using AWS, so any input would be helpful

3
  • Once check your security group out bond rules.may be it's related to firewall thing. Commented May 18, 2017 at 4:11
  • @Murali where on the console can I check the outbound rules? Commented May 18, 2017 at 4:20
  • Is your lambda function running in a vpc? If yes, you'll need to enable Internet access using a NAT instance or a NAT gateway. This is given in the lambda docs. docs.aws.amazon.com/lambda/latest/dg/vpc.html#vpc-internet Commented May 18, 2017 at 5:58

2 Answers 2

0

If you are using API Gateway as API endpoint which is connected to a lambda function, then you need to specify the body template in the API gateway itself. Make sure you are able to get the values at your Lambda function that you have been sending via the REST API call to your API gateway.

Please find the link to this answer I wrote earlier to achieve the same.

Sign up to request clarification or add additional context in comments.

2 Comments

My issue isn't to access the API endpoint, the issue is that when hitting the endpoint from mobile/postman after "serverless deploy", the code in the api is not able to call Firebase Cloud Messaging using fcm-push to send push notification. When I call this api locally, the push notification is sent perfectly
Are you using the Firebase Web SDK or, Firebase Admin SDK? The Firebase Admin SDK is meant to run on trusted devices, such as a Node.js server that you host. The Firebase Web SDK is targeted towards client-side devices such as browsers and Node.js IoT devices.
-1

You should check for any break point in your function.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.