Difference between a test call and a regular call

0

Hi,

When I call my GET URL by using the "Method Test" tool in API Gateway, I can see the correct parameters are being passed to my lambda function.
But if I call it in any other way (curl, postman, browser, ...) then my lambda function fails because the parameters are not transfered from the request to the lambda.

Is there some special HTTP Header I need to set, I already tried sending with

Content-Type:application/json
Accept:application/json

with no success.

In case it is needed here is my mapping template:

{
    "pid" : "$input.params('pid')",
    "uid" : "$input.params('uid')",
    "category" : "$input.params('cat')",
    "limit" : "$input.params('l')",
    "filter" : "$input.params('f')",
    "slug" : "$input.params('slug')"
}
gefragt vor 5 Jahren511 Aufrufe
2 Antworten
0
Akzeptierte Antwort

Hi,
What errors do you get when you try to invoke from browser/postman. I attempted to replicate your problem but, your mapping template worked fine in my environment. I tried using the GET-Method Execution TEST, a chrome browser, and through Postman. It worked successfully. My invocation looks like the following:

https://xxxxxxxx.execute-api.us-east-1.amazonaws.com/prod?pid=mypid&uid=myuid&cat=dog&l=med&f=dud&slug=yellow

Did you remember to include the "stage" name with your URL?
Did you remember to "Deploy" your latest version of API?

-randy

beantwortet vor 5 Jahren
0

Ok, thank you very much. It was a stupid problem.

I had no idea of the existence of the "Deploy API" action, that's why the changes I did where not being used. It is fixed now, all I had to do was deploy my new version of the API

beantwortet vor 5 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen