By any chance do you have this line in libs/dynamodb-lib.js:
AWS.config.update({ region: "us-east-1" });
By any chance do you have this line in libs/dynamodb-lib.js:
AWS.config.update({ region: "us-east-1" });
Thanks for helping out @justBanks
That looks really strange. Which version of serverless are you using?
@jayair Iāve been going through the tutorial. I want to ask about the URL path defined in the serverless.yml file. What does it do and is it necessary to have it the same as your database name? Thank you very much.
Can you point me to the line that you are confused about?
I have the same issue where I run either
serverless invoke local --function create --path mocks/create-event.json
serverless invoke local --function get --path mocks/get-event.json
both return nothing in terminal after I abstract w/ js files in libs dir
How were you able to get the 200 or 500 responses?
same here after abstracting the responses and DB in the libs dir
So it was working fine before you abstract stuff out?
Hi
Thanks for the tutorial, everything was going smoothly until I hit this point.
I have the same problem as a couple people prior in that when I enter the following in the terminal:
serverless invoke local --function create --path mocks/create-event.json
I get back the command prompt with nothing else:
I have changed my region to āus-east-2ā in both places on my serverless.yml file.
Here are my config and credential files:
Config file: ~/.aws/config
[default]
region = us-east-2
Credentials: ~/.aws/credentials
aws_access_key_id=XXXXXXXX
aws_secret_access_key=XXXXXXX
When I enter āaws s3 lsā in the terminal, I get back the proper name of my bucket
When I enter āaws dynamodb list-tablesā, I get back: {āTableNamesā: [ānotesā]}
I"m not really sure what my next steps would be to troubleshoot this.
Any help would be appreciated.
Thanks.
Oh. The region aspect seems good. Which version of Serverless are you using btw?
It is the current one, as I had just installed it.
But I just figured out the problemā¦there were 2 issues:
Once I did that and re-ran the command, I was rewarded with a statusCode: 200.
Your one question regarding Serverless version in your response led me to the solution. Thanks for the helpā¦Iām onto the next step.
Awesome. Iāll keep that in mind when somebody else runs into this.
I am sorry, I am new here and I am not a full-stack developer, but I want to learn. I had followed the tutorial until here, but in this step I get the following:
Serverless: INVOKING INVOKE
{
"statusCode": 500,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
},
"body": "{\"status\":false}",
"error": {
"message": "The security token included in the request is invalid.",
"code": "UnrecognizedClientException",
"time": "2018-11-15T21:47:15.730Z",
"requestId": "AIAJB0AVBFOBQJRHUF8FTIS70RVV4KQNSO5AEMVJF66Q9ASUAAJG",
"statusCode": 400,
"retryable": false,
"retryDelay": 43.334367945545004
}
}
Can someone to help me please?
I had applied the refactoring of this step and the error now is the following:
Serverless: Bundling with Webpack...
Time: 864ms
Built at: 2018-11-15 16:30:05
Asset Size Chunks Chunk Names
create.js 10.1 KiB create [emitted] create
create.js.map 7.23 KiB create [emitted] create
Entrypoint create = create.js create.js.map
[./create.js] 2.36 KiB {create} [built]
[./libs/dynamodb-lib.js] 468 bytes {create} [built]
[./libs/response-lib.js] 762 bytes {create} [built]
[aws-sdk] external "aws-sdk" 42 bytes {create} [built]
[babel-runtime/core-js/json/stringify] external "babel-runtime/core-js/json/stringify" 42 bytes {create} [built]
[babel-runtime/helpers/asyncToGenerator] external "babel-runtime/helpers/asyncToGenerator" 42 bytes {create} [built]
[babel-runtime/regenerator] external "babel-runtime/regenerator" 42 bytes {create} [built]
[source-map-support/register] external "source-map-support/register" 42 bytes {create} [built]
[uuid] external "uuid" 42 bytes {create} [built]
Serverless: INVOKING INVOKE
{ UnrecognizedClientException: The security token included in the request is invalid.
at Request.extractError (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\protocol\json.js:48:27)
at Request.callListeners (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:683:14)
at Request.transition (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\state_machine.js:14:12)
at E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:685:12)
at Request.callListeners (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
at Request.emit (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:683:14)
at Request.transition (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\state_machine.js:14:12)
at E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\request.js:685:12)
at Request.callListeners (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
at callNextListener (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\sequential_executor.js:96:12)
at IncomingMessage.onEnd (E:\Documentos Usuarios\DELGADOCJ\Desktop\Serverless\notes-app-api\node_modules\aws-sdk\lib\event_listeners.js:298:13)
at IncomingMessage.emit (events.js:187:15)
at IncomingMessage.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
message: 'The security token included in the request is invalid.',
code: 'UnrecognizedClientException',
time: 2018-11-15T22:30:06.148Z,
requestId: 'CKV6C8ARL1HJR7L8GQN2EORHORVV4KQNSO5AEMVJF66Q9ASUAAJG',
statusCode: 400,
retryable: false,
retryDelay: 32.77251605004998 }
{
"statusCode": 500,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Credentials": true
},
"body": "{\"status\":false}"
}
I solved my problem. I made a mistake in a previous step with the command aws configure.
Thanks!
New to Serverless here, so hopefully this is something obviously. I am working on Windows and used the AWS CLI MSI installer if that matters here. I have walked through this a couple of times now from scratch, changing nothing in the tutorial. When I get to the point of testing the create endpoint using the mock JSON, the command executes and I get what appears to be a build process in the command line interface, then nothing. No API response. The process just ends with no apparent error and not API response.
The command line interface shows the following:
D:\Projects\serverless-stack\notes-app-api>serverless invoke local --function create --path mocks/create-event.json
Serverless: Bundling with Webpack...
Time: 2634ms
Built at: 2018-11-22 19:51:14
Asset Size Chunks Chunk Names
create.js 7.16 KiB create [emitted] create
create.js.map 6.98 KiB create [emitted] create
Entrypoint create = create.js create.js.map
[./create.js] 2.08 KiB {create} [built]
[aws-sdk] external "aws-sdk" 42 bytes {create} [built]
[babel-runtime/core-js/json/stringify] external "babel-runtime/core-js/json/stringify" 42 bytes {create} [built]
[source-map-support/register] external "source-map-support/register" 42 bytes {create} [built]
[uuid] external "uuid" 42 bytes {create} [built]
Not real sure where to turn here, so hopefully somebody can point out what I have missed. Thanks!
Iām seeing exactly the same issue, working through the tutorial on my Mac
$ node -v
v8.12.0
$ npm -v
6.4.1
$ serverless -v
1.33.2
$ aws --version
aws-cli/1.16.60 Python/3.7.1 Darwin/18.2.0 botocore/1.12.50
Iām getting the same as @jchastain and @benoram, on Ubuntu 18.04.
$ serverless invoke local --function create --path mocks/create-event.json
Serverless: Bundling with Webpack...
Time: 831ms
Built at: 11/24/2018 11:39:33 PM
Asset Size Chunks Chunk Names
create.js 7.42 KiB create [emitted] create
create.js.map 7.15 KiB create [emitted] create
Entrypoint create = create.js create.js.map
[./create.js] 2.34 KiB {create} [built]
[aws-sdk] external "aws-sdk" 42 bytes {create} [built]
[babel-runtime/core-js/json/stringify] external "babel-runtime/core-js/json/stringify" 42 bytes {create} [built]
[source-map-support/register] external "source-map-support/register" 42 bytes {create} [built]
[uuid] external "uuid" 42 bytes {create} [built]
$ node --version
v8.10.0
$ npm --version
6.4.1
$ serverless --version
1.33.2
$ aws --version
aws-cli/1.16.60 Python/3.6.7 Linux/4.15.0-38-generic botocore/1.12.50
Ok Iām not sure what was causing it but after about 1 hour of debugging I decided to try to move on and, to my surprise, it is apparently fixed by the refactoring of the code in the last step.
So thereās that.