Im brand new to AWS API Gateways and Lambda. I am trying to get the basic 'Hello from Lambda!' function to work.
I can sign in successfully as below:
const user = await Auth.signIn(email, password);
I get A token back which is correct as I tested it on the AWS API console and got the response
//token works as tested on AWS Console (API Tester)
const token = user2.signInUserSession.idToken.jwtToken
I assume that the request info is correct as the token is correct:
const requestInfo = {
headers: {
Authorization: token
}
}
I think the error is here as whenever I try to do anything with the 'Data' I don't get a response
const data = await API.get('API_NAME','/hello',requestInfo)
console.log('This is the Data: ',{ data } )
The Error I get in the try/catch Xcode is:
'API API_NAME does not exist'
any suggestions?
Error I get when I run Amplify Push:
Packaging lambda failed function failed with the error
Command failed with exit code 1: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: APP_NAME@1.0.1
npm ERR! Found: react@16.8.6
npm ERR! node_modules/react
npm ERR! react@"16.8.6" from the root project
npm ERR! peer react@"^16.7.0" from @aws-amplify/ui-react@0.2.36
npm ERR! node_modules/@aws-amplify/ui-react
npm ERR! @aws-amplify/ui-react@"^0.2.35" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.14.0" from react-dom@16.14.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@"^16.7.0" from @aws-amplify/ui-react@0.2.36
npm ERR! node_modules/@aws-amplify/ui-react
npm ERR! @aws-amplify/ui-react@"^0.2.35" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/name/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/name/.npm/_logs/2021-02-02T09_36_01_091Z-debug.log
An error occurred during the push operation: Packaging lambda failed function failed with the error
Command failed with exit code 1: npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: APP_NAME@1.0.1
npm ERR! Found: react@16.8.6
npm ERR! node_modules/react
npm ERR! react@"16.8.6" from the root project
npm ERR! peer react@"^16.7.0" from @aws-amplify/ui-react@0.2.36
npm ERR! node_modules/@aws-amplify/ui-react
npm ERR! @aws-amplify/ui-react@"^0.2.35" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.14.0" from react-dom@16.14.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom@"^16.7.0" from @aws-amplify/ui-react@0.2.36
npm ERR! node_modules/@aws-amplify/ui-react
npm ERR! @aws-amplify/ui-react@"^0.2.35" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/name/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/name/.npm/_logs/2021-02-02T09_36_01_091Z-debug.log