You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using the amplify client adding a path with a python lambda function to a REST API, the hello world template does not work out of the box.
To Reproduce
Using the amplify cli:
amplify update api
? Please select from one of the below mentioned services: REST
? Please select the REST API you would want to update ReSoBuAPI
? What would you like to do Add another path
? Provide a path (e.g., /book/{isbn}): /test
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: testalambda
? Provide the AWS Lambda function name: testalambda
? Choose the runtime that you want to use: Python
Only one template found - using Hello World by default.
? Do you want to access other resources in this project from your Lambda function? No
? Do you want to invoke this function on a recurring schedule? No
? Do you want to configure Lambda layers for this function? No
? Do you want to edit the local lambda function now? No
Successfully added resource testalambda locally.
Next steps:
Check out sample function code generated in /amplify/backend/function/testalambda/src
"amplify function build" builds all of your functions currently in the project
"amplify mock function " runs your function locally
"amplify push" builds all of your local backend resources and provisions them in the cloud
"amplify publish" builds all of your local backend and front-end resources (if you added hosting category) and provisions them in the cloud
Succesfully added the Lambda function locally
? Restrict API access No
? Do you want to add another path? No
Successfully updated resource
amplify push
Resulted in the following error (python version on path is python 3.8)
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
(node:43186) UnhandledPromiseRejectionWarning: Error: Could not find a pipenv site-packages directory at /Users/chazarabriseis/.local/share/virtualenvs/testalambda-XXR/lib/python3.9/site-packages
got an error
fixed this by changing the folder of python3.8 to python3.9
Expected behaviour
When using out of the box templates I expect things to work so I can then go straight from there and edit the working template to my usecase.
Desktop (please complete the following information):
OS: macOS high sierra
Browser chrome
Version [e.g. 22]
Additional context
It would be great if you could change the hello world python template so it works out of the box by returning a dictionary with a status Code, headers and a body containing a json string. Or documentation that walks newbies through these steps.
The text was updated successfully, but these errors were encountered:
Describe the bug
Using the amplify client adding a path with a python lambda function to a REST API, the hello world template does not work out of the box.
To Reproduce
Using the amplify cli:
? Please select from one of the below mentioned services: REST
? Please select the REST API you would want to update ReSoBuAPI
? What would you like to do Add another path
? Provide a path (e.g., /book/{isbn}): /test
? Choose a Lambda source Create a new Lambda function
? Provide a friendly name for your resource to be used as a label for this category in the project: testalambda
? Provide the AWS Lambda function name: testalambda
? Choose the runtime that you want to use: Python
Only one template found - using Hello World by default.
? Do you want to access other resources in this project from your Lambda function? No
? Do you want to invoke this function on a recurring schedule? No
? Do you want to configure Lambda layers for this function? No
? Do you want to edit the local lambda function now? No
Successfully added resource testalambda locally.
Next steps:
Check out sample function code generated in /amplify/backend/function/testalambda/src
"amplify function build" builds all of your functions currently in the project
"amplify mock function " runs your function locally
"amplify push" builds all of your local backend resources and provisions them in the cloud
"amplify publish" builds all of your local backend and front-end resources (if you added hosting category) and provisions them in the cloud
Succesfully added the Lambda function locally
? Restrict API access No
? Do you want to add another path? No
Successfully updated resource
amplify push
Resulted in the following error (python version on path is python 3.8)
To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
(node:43186) UnhandledPromiseRejectionWarning: Error: Could not find a pipenv site-packages directory at /Users/chazarabriseis/.local/share/virtualenvs/testalambda-XXR/lib/python3.9/site-packages
got an error
fixed this by changing the folder of python3.8 to python3.9
testing the API via my frontend resulted in:
Access to XMLHttpRequest at 'https://xxx.execute-api.eu-central-1.amazonaws.com/dev/test' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
xhr.js:172 POST https://z3c0n1vg14.execute-api.eu-central-1.amazonaws.com/dev/check-for-chats net::ERR_FAILED
createError.js:16 Uncaught (in promise) Error: Network Error
at createError (createError.js:16)
at XMLHttpRequest.handleError (xhr.js:81)
fixed this by changing the lambda function code to:
Expected behaviour
When using out of the box templates I expect things to work so I can then go straight from there and edit the working template to my usecase.
Desktop (please complete the following information):
Additional context
It would be great if you could change the hello world python template so it works out of the box by returning a dictionary with a status Code, headers and a body containing a json string. Or documentation that walks newbies through these steps.
The text was updated successfully, but these errors were encountered: