Lambda function is not recognizing LexBot - aws-lambda

I have created simple Lambda function (simple nodejs application) and trying to integrate with Lex bot. have followed the aws doc and created the execution role. configured the lex bot with proper alias and associated the version as well.
this is the doc being followed
when I am testing the lambda function execution it throws following error:
{
"errorType": "BadRequestException",
"errorMessage": "INVALID_REQUEST - Invalid bot name or alias",
"trace": [
"BadRequestException: INVALID_REQUEST - Invalid bot name or alias",
" at Object.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:52:27)",
" at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/rest_json.js:55:8)",
" at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:106:20)",
" at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:78:10)",
" at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:688:14)",
" at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
" at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
" at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10",
" at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)",
" at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:690:12)"
]
}
bot name and alias is valid. i checked that. still it throws error.
how to debug this?

I am facing the same thing, aws lex-models get-bots returns an empty list although bots are present.
aws lexv2-runtime recognize-text --bot-id <botId> --bot-alias-id TSTALIASID --locale-id 'en_GB' --session-id 'test_sessio1n' --text 'my input test'
The above gives a proper response.
I am guessing this is an issue with Lex v1 vs v2.

In the Lex Bot make sure you create a separate alias from the default one that is present and try it. Also, ensure to provide the right alias ID and the bot ID in your code.

I encountered the same error when trying to use the #aws_sdk/client-lex-runtime-service client's PutText command (which uses the botName and botAlias) with a Lex V2 chatbot, which apparently isn't compatible. The fix was to use the newer #aws-sdk/client-lex-runtime-v2 client's RecognizeText command (which uses the botAliasId, botId, localeId and sessionId).

Related

Using vsce via command line in Github Action throws Invalid publisher name error

We have an existing extension that is already in the VS Code market place.
I'm trying to automate publishing by using Github Actions and executing this command...
vsce publish -p ${{ secrets.VSCODE_PAT }}
When the command executes I'm getting this error:
ERROR Invalid publisher name 'Wilderness Labs'. Expected the
identifier of a publisher, not its human-friendly name.
The vscode documentation doesn't really help in this situation. Any ideas/suggestions?
The publisher name MUST NOT be a string literal with spaces. As mentioned by #Lex it needs to be a something like WildernessLabs or wilderness-labs or whatever it is for your own organisation.

Does "SAM Local Invoke" support EFS?

I'm using Lambda to access EFS as described at https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html
The lambda function works fine when running in AWS, but it fails when using SAM with the "local invoke" command. The error is
2020-10-02T20:03:19.389Z 09b6f1b2-d80a-15e1-9531-f74182e95c1e ERROR Invoke Error
{
"errorType":"Error",
"errorMessage":"ENOENT: no such file or directory, open '/mnt/efs/newfile.txt'",
"code":"ENOENT",
"errno":-2,
"syscall":"open",
"path":"/mnt/efs/newfile.txt",
"stack":[
"Error: ENOENT: no such file or directory, open '/mnt/efs/newfile.txt'",
" at Object.openSync (fs.js:458:3)",
" at Object.writeFileSync (fs.js:1355:35)",
" at WriteFile (/var/task/src/apis/permissions/isallowed.js:70:8)",
" at IsAllowedInPolicy (/var/task/src/apis/permissions/isallowed.js:52:5)",
" at Runtime.exports.handler (/var/task/src/apis/permissions/isallowed.js:16:28)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}
Is "sam local invoke" supposed to work with EFS?
The answer is no.
I opened a support ticket with AWS and was told
This is a limitation on the AWS SAM CLI and not your configuration.
Therefore, I have taken the initiative to submit an internal feature
request with our internal service team(specifically AWS SAM CLI
service team) on your behalf and I have added your company name and
voice to this request. At the moment, we would not be able to provide
an estimate on if or when this feature will be supported. I would
advise to check the AWS announcement page from time to time for future
service updates. https://aws.amazon.com/new/
I also discovered that someone submitted a feature request on GitHub as a workaround.

"token does not exist"

Hello and good afternoon all!
I have a problem with ASK CLI in that when I attempt to utilize "ask clone " it returns this error in my console:
ask clone amzn1.ask.skill.900c47d3-532f-45b5-975b-1c995c6dbd88
The property "token" does not exist.
/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:21
if ('expires_at' in this.token) {
^
TypeError: Cannot use 'in' operator to search for 'expires_at' in undefined
at new AccessToken (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:21:22)
at Object.createAccessToken [as create] (/usr/local/lib/node_modules/ask-cli/node_modules/simple-oauth2/lib/client/access-token.js:38:12)
at isTokenExpired (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:97:35)
at Object.tokenRefreshAndRead (/usr/local/lib/node_modules/ask-cli/lib/utils/oauth-wrapper.js:84:10)
at Object.module.exports.requestWithUrl (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:45:18)
at Object.module.exports.request (/usr/local/lib/node_modules/ask-cli/lib/api/request-wrapper.js:26:20)
at Object.callGetSkillStatus (/usr/local/lib/node_modules/ask-cli/lib/api/api-wrapper.js:229:20)
at Command.handle (/usr/local/lib/node_modules/ask-cli/lib/api/skill.js:213:20)
at Command.listener (/usr/local/lib/node_modules/ask-cli/node_modules/commander/index.js:315:8)
at Command.emit (events.js:182:13)
at Command.parseArgs (/usr/local/lib/node_modules/ask-cli/node_modules/commander/index.js:654:12)
at Command.parse (/usr/local/lib/node_modules/ask-cli/node_modules/commander/index.js:474:21)
at Object. (/usr/local/lib/node_modules/ask-cli/bin/ask-api.js:25:6)
at Module._compile (internal/modules/cjs/loader.js:707:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)
at Module.load (internal/modules/cjs/loader.js:605:32)
I have scoured the Earth for solutions and found one way to bypass this is to "downgrade" the oauth from '1.0.2' to '1.5.0' however this does not seem to work.
Any input/suggestions on this?
I had this problem a while ago. I uninstalled the cli and followed this tutorial to setup ASK-CLI and it worked.
When the ASK-CLI is installed for the first time it needs configuration with our aws account and amazon account. Sometimes our accounts are not get configured properly and results in problems in cloning and deploying the skill. It happen because the authentication token of CLI does not match with our accounts.
Solution:
Try running ask init command again. And If this does not work
Uninstall the ASK-CLI and install again. And Run ask init

Postgraphile - "Query Root must be provided" error message

We have an existing postgresql database with data and we are experimenting with postgraphile as a graphql API. We are running into an error that is leaving us scratching our head. the server runs fine but we get the following:
postgraphile -c postgres://username:password#localhost:5432/my_db
PostGraphile server listening on port 5000
‣ Connected to Postgres instance postgres://localhost:5432/my_db
‣ Introspected Postgres schema(s) public
‣ GraphQL endpoint served at http://localhost:5000/graphql
‣ GraphiQL endpoint served at http://localhost:5000/graphiql
* * *
An error occurred, it might be okay but it doesn't look like the error we were expecting... run with envvar 'DEBUG="graphile-build:warn"' to view the error
An error occurred, it might be okay but it doesn't look like the error we were expecting... run with envvar 'DEBUG="graphile-build:warn"' to view the error
Error: Query root type must be provided.
at assertValidSchema (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\node_modules\graphql\type\validate.js:78:11)
at Object.validate (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\node_modules\graphql\validation\validate.js:61:35)
at parseQuery (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:208:48)
at Promise.all.paramsList.map (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:469:63)
at Array.map (<anonymous>)
at requestHandler (C:\Users\user\AppData\Roaming\npm\node_modules\postgraphile\build\postgraphile\http\createPostGraphileHttpRequestHandler.js:435:52)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
and when we navigate to localhost:500/graphiql we see a a "no schema available" in the documentation explorer.
is the query root the publicschema? or what are we missing?
Newer versions of PostGraphile have much more helpful error messages, often including a suggested solution. The "An error occurred" errors like those above now also contain a preview of the underlying error which helps with diagnosis.
There are instructions here on how to set the DEBUG environmental variable here: https://www.graphile.org/postgraphile/debugging/#debug-envvars
Here's how you might do it in Linux, macOS or Windows:
# Bash (Linux, macOS, etc)
export DEBUG="graphile-build:warn" postgraphile -c postgres://username:password#localhost:5432/my_db
# Windows Console
set DEBUG=graphile-build:warn & postgraphile -c postgres://username:password#localhost:5432/my_db
# Windows PowerShell
$env:DEBUG = "graphile-build:warn"; postgraphile -c postgres://username:password#localhost:5432/my_db

Error when running `feathers generate authentication` for `RethinkDB`

I’m having issues when running feathers generate authentication with selecting rethinkdb as database.
Environment:
Mac OS X Sierra
feathers 2.2.3
npm 5.1.0
rethinkdb 2.3.5
Steps to reproduce:
I have up and running https://github.com/tenzan/feathers-chat.git
feathers generate authentication
Select Username + Password (Local)
What is the name of the user (entity) service? (users) <-- Enter
What kind of service is it? (Use arrow keys) ❯ RethinkDB <-- Enter
Output:
events.js:182
throw er; // Unhandled 'error' event
^
TypeError: Parameter "url" must be a string, not object
at Url.parse (url.js:102:11)
at Object.urlParse [as parse] (url.js:96:5)
at ConnectionGenerator._getConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:46:24)
at ConnectionGenerator._writeConfiguration (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:103:32)
at ConnectionGenerator.writing (/usr/local/lib/node_modules/feathers-cli/node_modules/generator-feathers/generators/connection/index.js:297:10)
at Object.<anonymous> (/usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:417:23)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:25:25
at Promise (<anonymous>)
at /usr/local/lib/node_modules/feathers-cli/node_modules/run-async/index.js:24:19
at /usr/local/lib/node_modules/feathers-cli/node_modules/yeoman-generator/lib/index.js:418:9
I had same errors on different Mac PCs with same environment.
It's an issue with generator-feathers
Remove the rethinkdb object from config/default
will see if I can fix the main problem
Edit: Fixed

Resources