- Newest
- Most votes
- Most comments
Hello! Based on how you've described your problem, I think there could be a discrepancy between the format of your test event and the format of a request via Function URL. If that's the case, then that would explain why your function is able to access the parameter with a test event but not when calling the Function URL.
To elaborate:
The format of the request you shared for the Function URL is the default format for requests made with a Function URL. The payload you include in the test events that you execute from the Lambda console should mirror that format as that's how the requests will be structured when calling the Function URL. If your test event payload JSON is simply {'epoch': 1724773643}
then that means your Lambda function is probably accessing 'epoch' based on that format (i.e. myPayload['epoch']
) instead of the format of a Function URL request (i.e. myPayload['queryStringParameters']['epoch']
). I would try creating a new test event, double-checking that the JSON you provide conforms to the request format linked above, and then testing your function based on that event.
Hope this helps out!
Relevant content
- Accepted Answerasked 6 months ago
- asked 3 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
It is the same code. The only difference is if I click the "test" button in the lambda editor screen, or if the code runs via someone connecting to the Function URL. I placed the lambda function behind API Gateway and it now works as expected.
I'm just not sure why it doesn't work the same via 'test' or via connecting to the URL.
I'm attempting to access the parameters via the EVENT variable:
def lambda_handler(event, context):
If I then perform:
print(event)
I see the differences described above for how it looks from API Gateway (or test button) and how it looks from someone hitting the Function URL.