Skip to content

Razorpay API getting timed out

0

I am running a go serverless app as Lambda function. This app has a web API endpoint that generates an Order in Razorpay and returns the OrderID to the client when triggered. On triggering this API via hopscotch I am receiving a Timeout Error. The error persists whether I am using Razorpay go SDK or directly calling their REST APIs. Also, the API runs perfectly fine when running as a native app in the local system and all other API endpoints run perfectly fine when running inside of AWS Lambda, and the Timeout happens only on this particular API.

Error received is following.

START RequestId: d89bbb51-a4ca-4829-b540-badd38decdcd Version: $LATEST
2024/08/31 06:50:54 INFO URI:- /api/plan/order | Method:- POST
2024-08-31T06:51:14.568Z d89bbb51-a4ca-4829-b540-badd38decdcd Task timed out after 20.02 seconds

END RequestId: d89bbb51-a4ca-4829-b540-badd38decdcd
REPORT RequestId: d89bbb51-a4ca-4829-b540-badd38decdcd	Duration: 20019.63 ms	Billed Duration: 20844 ms	Memory Size: 1024 MB	Max Memory Used: 19 MB	Init Duration: 843.72 ms

API in question https://8y0ac4hbfi.execute-api.ap-south-1.amazonaws.com/prod/api/plan/order

Tested on go version 1.22.3, 1.22.4, 1.23.0

  • Hello WeCoach.

    1. Is the Lambda function inside a VPC? If so, does it have proper internet access through a NAT gateway?
    2. Are you accessing the Razorpay API publicly or using a specific network configuration?
    3. What is the current timeout setting for the Lambda function, and have you tried increasing it?
    4. Have you checked Razorpay's logs for any error messages related to the timeout?
    5. Are the Lambda function and Razorpay API in the same AWS region to minimize latency?

    These questions can help narrow down the cause of the issue.

asked 2 years ago239 views

1 Answer
0
Accepted Answer

Hi,

Do you various APIs have different service endpoints by Razorpay ? If yes, check the sec groups related to your Lambda to make sure that it is authorized to reach the various Razorpay service endpoints, in particular if you attached your Lambda to a VPC.

In that case, see here for all details: https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html

Best,

Didier

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

  • This issue was solved by setting up internet access to Lambda by using a NAT Gateway in custom VPC.

  • Glad that you fixed your issue. Thanks for accepting my answer.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.