AWS API Gateway not found - aws-lambda

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

As you can sign in successfully I suppose you've configured Amplify something like this specifying AWS poolId, clientId etc.
Similarly you've to do for APIs also like documented here
This is the format, suppose API name is account.
Amplify.configure({
Auth: { ... },
API: {
endpoints: [
{
name: 'account', // name of API like 'account', no '/'
endpoint: BASE_URL, // like 'https://api_name.com', don't put '/' at the end
region: 'us-east-1', // your region like 'us-east-1', 'ap-southeast-1' etc.
},
... // Other APIs
]
}
});
Then when you call the API this would be the format
const accountRes: AccountData = await API.get('account', '/account', requestInfo);
NOTE:- If API name is same but request type is different (GET, POST, PUT etc.) you don't need to do multiple entries, You can simply call respective method for the request API.get(), API.post(), API.put() etc.

Related

unable to resolve dependency tree in react-redux

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: quora2.0#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" 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 C:\Users\Dell\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Local\npm-cache_logs\2022-11-06T06_29_10_297Z-debug-0.log
PS D:\Projects\QuoraClone\quora2.0> npm i #material-ui/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: quora2.0#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" 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 C:\Users\Dell\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Local\npm-cache_logs\2022-11-06T06_31_22_131Z-debug-0.log
PS D:\Projects\QuoraClone\quora2.0> npm config set legacy-peer-deps true
PS D:\Projects\QuoraClone\quora2.0> npm install
npm WARN deprecated stable#0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
npm WARN deprecated w3c-hr-time#1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
expecting to get answers

npm run dev command throwing error laravel 9.21.6

When i am opening a page it shows error
Vite manifest not found at: C:\xampp\htdocs\laravel_project\lara_project\public/build/manifest.json
and my command prompt showing error
# dev C:\xampp\htdocs\laravel_project\lara_project
vite
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader. Received protocol 'node:'
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:756:11)
at Loader.resolve (internal/modules/esm/loader.js:85:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:229:28)
at ModuleWrap. (internal/modules/esm/module_job.js:51:40)
at link (internal/modules/esm/module_job.js:50:36) {
code: 'ERR_UNSUPPORTED_ESM_URL_SCHEME'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: vite
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sudha\AppData\Roaming\npm-cache_logs\2022-07-24T09_53_42_124Z-debug.log

Unable to install botbuilder-ai-orchestrator on my existing bot

I have created a bot with azure bot framework composer and it seems to be working fine. Now I want to add other bots as skills in it and I am required to install botbuilder-ai-orchestrator bit it is failing with the following error
Command failed: npm install --loglevel=error --save botbuilder-ai-orchestrator npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: BotName#undefined npm ERR! Found: botbuilder-dialogs-declarative#4.15.0-preview npm ERR! node_modules/botbuilder-dialogs-declarative npm ERR! peer botbuilder-dialogs-declarative#"~4.15.0-preview" from #microsoft/bot-components-teams#1.2.1 npm ERR! node_modules/#microsoft/bot-components-teams npm ERR! #microsoft/bot-components-teams#"^1.2.1" from the root project npm ERR! botbuilder-dialogs-declarative#"4.15.0-preview" from botbuilder-ai#4.15.0 npm ERR! node_modules/botbuilder-ai npm ERR! botbuilder-ai#"4.15.0" from botbuilder-ai-luis#4.15.0-preview npm ERR! node_modules/botbuilder-ai-luis npm ERR! botbuilder-ai-luis#"4.15.0-preview" from botbuilder-dialogs-adaptive-runtime#4.15.0-preview npm ERR! node_modules/botbuilder-dialogs-adaptive-runtime npm ERR! botbuilder-dialogs-adaptive-runtime#"4.15.0-preview" from botbuilder-dialogs-adaptive-runtime-integration-express#4.15.0-preview npm ERR! node_modules/botbuilder-dialogs-adaptive-runtime-integration-express npm ERR! 1 more (the root project) npm ERR! botbuilder-ai#"4.15.0" from botbuilder-ai-qna#4.15.0-preview npm ERR! node_modules/botbuilder-ai-qna npm ERR! botbuilder-ai-qna#"4.15.0-preview" from botbuilder-dialogs-adaptive-runtime#4.15.0-preview npm ERR! node_modules/botbuilder-dialogs-adaptive-runtime npm ERR! botbuilder-dialogs-adaptive-runtime#"4.15.0-preview" from botbuilder-dialogs-adaptive-runtime-integration-express#4.15.0-preview npm ERR! node_modules/botbuilder-dialogs-adaptive-runtime-integration-express npm ERR! 1 more (the root project) npm ERR! 2 more (botbuilder-dialogs-adaptive, botbuilder-dialogs-adaptive-runtime) npm ERR! npm ERR! Could not resolve dependency: npm ERR! botbuilder-ai-orchestrator#"*" from the root project npm ERR! npm ERR! Conflicting peer dependency: botbuilder-dialogs-declarative#4.16.0-preview npm ERR! node_modules/botbuilder-dialogs-declarative npm ERR! peer botbuilder-dialogs-declarative#"4.16.0-preview" from botbuilder-ai-orchestrator#4.16.0 npm ERR! node_modules/botbuilder-ai-orchestrator npm ERR! botbuilder-ai-orchestrator#"*" 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 C:\Users\username\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\username\AppData\Local\npm-cache\_logs\2022-07-14T10_23_29_714Z-debug-0.log
Node version installed on my machine is 16.16.0
Below is the list of dependencies already insatlled
"#microsoft/bot-components-teams": "^1.2.1",
"botbuilder-ai-luis": "4.15.0-preview",
"botbuilder-ai-qna": "4.15.0-preview",
"botbuilder-dialogs-adaptive-runtime-integration-express": "4.15.0-preview",
"cross-env": "latest"

Laravel 9 Install vue router for vue 2.6.12

I try installing vue router with run command "npm install vue-router" but then showing error like this:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vue#2.6.14
npm ERR! dev vue#"^2.6.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.2.0" from vue-router#4.0.14
npm ERR! node_modules/vue-router
npm ERR! vue-router#"*" from the root project
npm ERR!
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 C:\Users\ACER\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ACER\AppData\Local\npm-cache_logs\2022-03-20T12_19_15_072Z-debug-0.log
please help
I solved it by installing vue-router#3.
npm install vue-router#3 --save
You can just try this.
Because your vue is not the latest version, it gives this error.
Use previous versions of vue-router.
To access old versions of vue-router, use the versions tab
Example : npm i vue-router#3.5.3

Cant install cordova in my mac os x

When I am installing through terminal I got the error below
npm ERR! network getaddrinfo ENOTFOUND
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/abp2
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! syscall getaddrinfo
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/abp2/npm-debug.log
npm ERR! not ok code 0
I followed many answers in this community, but still not able to install this.
According to some suggestion I have change install cordova code like that
$ sudo npm --proxy proxy-server:8080 install -g cordova
But here I am getting problem like that
npm ERR! fetch failed https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/glob/-/glob-4.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/npmconf/-/npmconf-0.1.16.tgz
npm ERR! fetch failed https://registry.npmjs.org/osenv/-/osenv-0.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/plist/-/plist-1.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/rc/-/rc-0.5.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/request/-/request-2.47.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/tar/-/tar-1.0.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/glob/-/glob-4.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/npmconf/-/npmconf-0.1.16.tgz
npm ERR! fetch failed https://registry.npmjs.org/osenv/-/osenv-0.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/plist/-/plist-1.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/rc/-/rc-0.5.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/request/-/request-2.47.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/tar/-/tar-1.0.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/bplist-parser/-/bplist-parser-0.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/glob/-/glob-4.0.6.tgz
npm ERR! fetch failed https://registry.npmjs.org/npmconf/-/npmconf-0.1.16.tgz
npm ERR! fetch failed https://registry.npmjs.org/osenv/-/osenv-0.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/plist/-/plist-1.1.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/rc/-/rc-0.5.2.tgz
npm ERR! fetch failed https://registry.npmjs.org/request/-/request-2.47.0.tgz
npm ERR! fetch failed https://registry.npmjs.org/tar/-/tar-1.0.2.tgz
npm ERR! network tunneling socket could not be established, cause=connect EHOSTUNREACH
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "--proxy" "proxy-server:8080" "install" "-g" "cordova"
npm ERR! cwd /Users/abp2
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ECONNRESET
npm ERR! not ok code 0
Thanks in advance.

Resources