Open losnappas opened 3 years ago
I'm having this issue as well using SAM CLI. Is there some sort of parameter or environment variable that needs to be set for the context deadline?
Can confirm I'm also having this issue when calling Dynamo with the Lambda context in SAM local:
_, err = ddb.PutItemWithContext(ctx, &piu) // Deadline exceeded..
Looks like when the CTX arrives to the handler it's in the past:
Lambda CTX deadline: 2021-04-27 10:07:09.7504344 +0000 UTC
Time now: 2021-04-27 10:07:09.7511904 +0000 UTC
Downgrading my version of SAM to 1.12.0 fixed the issue:
pip3 install --user 'aws-sam-cli==1.12.0'
Also, related:
https://github.com/aws/aws-sam-cli/issues/2510 https://github.com/aws/aws-sam-cli/issues/2519
i have same issue :
amplify add function testFunc
then choose go
with default config ,then:
amplify mock function testFunc
the output:
? Provide the path to the event JSON object relative to ..../amplify/backend/function/testFunc src/event.json
Ensuring latest function changes are built...
Starting execution...
Local invoker binary was not found, building it...
go: github.com/aws/aws-lambda-go@v1.15.0: missing go.sum entry; to add it:
go mod download github.com/aws/aws-lambda-go
testFunc failed with the following error:
Error: Command failed with exit code 1: go build main.go
at makeError (/home/me/.config/yarn/global/node_modules/execa/lib/error.js:59:11)
at Function.module.exports.sync (/home/me/.config/yarn/global/node_modules/execa/index.js:188:17)
at Object.executeCommand (/home/me/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/runtime.ts:31:24)
at buildLocalInvoker (/home/me/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/localinvoke.ts:29:5)
at Object.localInvoke (/home/me/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/localinvoke.ts:67:30)
at Object.invoke (/home/me/.config/yarn/global/node_modules/amplify-go-function-runtime-provider/src/index.ts:26:24)
at /home/me/.config/yarn/global/node_modules/amplify-category-function/src/index.ts:185:20
at Object.start (/home/me/.config/yarn/global/node_modules/amplify-util-mock/src/func/index.ts:48:49)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at Object.run (/home/me/.config/yarn/global/node_modules/amplify-util-mock/src/commands/mock/function.ts:14:5)
at Object.executeAmplifyCommand (/home/me/.config/yarn/global/node_modules/amplify-util-mock/src/amplify-plugin-index.ts:8:3)
at executePluginModuleCommand (/home/me/.config/yarn/global/node_modules/@aws-amplify/cli/src/execution-manager.ts:175:3)
at Object.executeCommand (/home/me/.config/yarn/global/node_modules/@aws-amplify/cli/src/execution-manager.ts:28:5)
at Object.run (/home/me/.config/yarn/global/node_modules/@aws-amplify/cli/src/index.ts:139:5) {
shortMessage: 'Command failed with exit code 1: go build main.go',
command: 'go build main.go',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: undefined,
stderr: undefined,
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
Finished execution.
whenever i built the same function and others functions and tested them using Dockerfile:
FROM amazon/aws-lambda-go:latest
COPY main ${LAMBDA_TASK_ROOT}
CMD [ "main" ]
and trigger it by curl:
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"payload":"world"}'
>hello world!
Note there's no issue when using nodejs
.
Still facing the issue with SAM CLI version 1.25.0 on Ubuntu. Any workarounds for that?
SAM CLI, version 1.26.0 The same issue on Ubuntu
Same issue on MacOS SAM CLI, version 1.29.0
Same issue on MacOS SAM CLI, version 1.29.0
I'm running the lambda image locally, and long story short, it starts off with an expired context deadline.
curl localhost:8080/2015-03-31/functions/function/invocations
logs
"context deadline exceeded"
What am I missing? Here it says
But it's essentially returning the starting time instead.