amplify-js: TypeError on API request.
** Which Category is your question related to? ** API ** What AWS Services are you utilizing? ** API Gateway ** Provide additional details e.g. code snippets ** I’m trying to add a REST API as this example:
https://aws-amplify.github.io/docs/js/api#post
The headers I set like the following:
let myInit = {
body: {},
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
}
};
But there is an error
error TypeError: headers[key].trim is not a function
at Signer.ts:110
at Array.map (<anonymous>)
at canonical_headers (Signer.ts:105)
at canonical_request (Signer.ts:155)
at Function.Signer.sign (Signer.ts:314)
at RestClient._signed (RestClient.ts:279)
at RestClient.ts:148
I’m using Amplify in React aws-amplify@2.2.1 aws-amplify-react@3.1.2
Thanks for any help!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 18 (1 by maintainers)
In my opinion, the problem comes from the API gateway. Do you use a lambda_proxy on your integration request ?
Awesome ! I’m glad I could help you 😃
Hi, i have the same problem. And if i remove headers, i have CORS problem…