- Newest
- Most votes
- Most comments
Based on the information provided, it seems that the issue is not likely related to AWS infrastructure or networking configuration, but rather to how the Lambda function is handling the response from the third-party service. Here are a few points to consider:
-
The fact that you're receiving a "Not Found" response instead of a timeout suggests that the request is reaching the third-party service and a response is being returned. This indicates that your network configuration (VPC, NAT Gateway, security groups) is likely correct.
-
The successful call to the dictionary API further supports that your Lambda function has proper internet access and can make outbound requests.
-
The discrepancy between the Postman response (201 Created) and the Lambda response (Not Found) suggests that the issue might be in how the Lambda function is processing or interpreting the response from the third-party service.
Here are some steps you can take to troubleshoot:
-
Log the entire response object (status code, headers, and body) from the third-party service within your Lambda function. This will help you understand exactly what response the Lambda is receiving.
-
Check if the third-party service is returning different responses based on the request origin. Some services might behave differently when called from AWS IP ranges compared to your local machine.
-
Verify that your Lambda function is correctly parsing and handling the response from the third-party service. There might be an issue in the code that's misinterpreting a successful response as "Not Found".
-
Ensure that your Lambda function has the latest SDK or library for interacting with the third-party service, as there could be compatibility issues.
-
Check if the third-party service requires any specific headers or authentication that might be missing in the Lambda request but present in your Postman request.
-
If possible, try to replicate the exact request your Lambda is making using Postman, including all headers and body content, to see if you can reproduce the issue.
-
Consider using AWS X-Ray to trace the request and get more detailed information about the interaction between your Lambda and the third-party service.
If after these steps you're still encountering issues, you may need to reach out to the third-party service provider to see if they can offer any insights into why the responses might differ between your local environment and AWS Lambda.
Sources
Troubleshoot networking issues in Lambda - AWS Lambda
Troubleshoot ETIMEDOUT error in my Lambda function | AWS re:Post
Hi,
As you're receiving a "Not Found" response instead of a timeout, the request is reaching the third-party service and a response is being returned. So, your network config is probably correct.
What I'd rather check are the credentials that you use for the remote service: they are probably different between your laptop and the Lambda.
Some applications - to maximize security - don't say 403 (Auth issue) but 404 when you try a REST action on an object that you're not allowed to. This way they don't disclose to the unauthorized object exist.
So, check the credentials of your Lambda toward the remote service. The issue is probably there!
Didier
Hello,
I understand that when your Lambda is returning NOT FOUND error from the third-party service. :
The "Not Found" response, rather than a timeout, indicates that the request is reaching the third-party service. This, along with successful calls to other APIs, suggests proper network configuration and internet access. The discrepancy between Postman and Lambda responses points to a potential issue in how the Lambda function processes the third-party service's response, rather than a general networking problem.
I also found a few third party articles who faced the similar issue which might help[+]
[+] https://stackoverflow.com/questions/62699781/receiving-a-404-error-on-aws-lambda-post-request
In case you have additional queries or follow-up queries or if the problem still persists regarding AWS API Gateway or Lambda, we may require details that are non-public information to assist you better. Please open a support case with AWS using the following link.
Relevant content
- Accepted Answerasked 5 months ago
- asked 3 years ago
- AWS OFFICIALUpdated 6 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago