Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context deadline exceeded at start locally #361

Open
losnappas opened this issue Feb 27, 2021 · 7 comments
Open

Context deadline exceeded at start locally #361

losnappas opened this issue Feb 27, 2021 · 7 comments

Comments

@losnappas
Copy link

I'm running the lambda image locally, and long story short, it starts off with an expired context deadline.

package main

import (
	"context"
	"log"

	"github.com/aws/aws-lambda-go/lambda"
)

func Handler(ctx context.Context) {
	log.Println(ctx.Err())
	log.Println(ctx.Deadline())
}
func main() {
	lambda.Start(Handler)
}
# installer
FROM golang:1.15-alpine3.12@sha256:4d8abd16b03209b30b48f69a2e10347aacf7ce65d8f9f685e8c3e20a512234d9 as installer
WORKDIR /build

COPY ./go.mod ./go.sum ./

RUN go mod download

# builder
FROM installer as builder

COPY . ./

RUN CGO_ENABLED=0 GOOS=linux go build -o Main ./main.go

# release
FROM public.ecr.aws/lambda/go:latest

COPY --from=builder /build/Main .

CMD ["./Main"]

curl localhost:8080/2015-03-31/functions/function/invocations

logs

time="2021-02-27T23:20:12.39" level=info msg="exec '/var/runtime/bootstrap' (cwd=/var/task, handler=)"
time="2021-02-27T23:20:48.623" level=info msg="extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory"
time="2021-02-27T23:20:48.624" level=warning msg="Cannot list external agents" error="open /opt/extensions: no such file or directory"
START RequestId: 9af7aefe-d612-4f5e-9e75-c9cdeadab9f5 Version: $LATEST
2021/02/27 23:20:48 context deadline exceeded
2021/02/27 23:20:48 2021-02-27 23:20:48.631152628 +0000 UTC true
END RequestId: 9af7aefe-d612-4f5e-9e75-c9cdeadab9f5
REPORT RequestId: 9af7aefe-d612-4f5e-9e75-c9cdeadab9f5  Init Duration: 0.20 ms  Duration: 7.73 ms       Billed Duration: 100 ms        Memory Size: 3008 MB    Max Memory Used: 3008 MB

"context deadline exceeded"

What am I missing? Here it says

Context methods
Deadline – Returns the date that the execution times out, in Unix time milliseconds.

But it's essentially returning the starting time instead.

@JadenSimon
Copy link

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?

@drwxmrrs
Copy link

drwxmrrs commented Apr 27, 2021

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:

aws/aws-sam-cli#2510
aws/aws-sam-cli#2519

@annymosse

This comment has been minimized.

@EltonGarcia
Copy link

Still facing the issue with SAM CLI version 1.25.0 on Ubuntu. Any workarounds for that?

@andrew-yustyk
Copy link

SAM CLI, version 1.26.0
The same issue on Ubuntu

@robin-sanner
Copy link

Same issue on MacOS SAM CLI, version 1.29.0

1 similar comment
@zkhan96
Copy link

zkhan96 commented Sep 1, 2021

Same issue on MacOS SAM CLI, version 1.29.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants