You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all,
I am trying to get sam api running locally in a container but keep hitting roadblocks, I've now gotten as far as Sam building in the container and running. However, whenever trying to connect I get the following:
Mounting /app/.aws-sam/build/ServiceFn as /var/task:ro,delegated, inside runtime container
[Container state] OOMKilled False
Cleaning all decompressed code dirs
Timed out while attempting to establish a connection to the container. You can increase this timeout by setting the SAM_CLI_CONTAINER_CONNECTION_TIMEOUT environment variable. The current timeout is 20.0 (seconds).
Invalid lambda response received: Lambda response must be valid json
Lambda execution failed ()
Watching Docker I can see it spin up another container, but nothing happens, eventually the timeout hits, this message appears and the container disappears.
At a loss as to what to do here, so any help would be appreciated.
DockerFile
FROM public.ecr.aws/sam/build-go1.x:latest
WORKDIR /app
# Install system dependencies
RUN yum update -y && \
yum install -y \
git \
make \
wget \
tar \
gzip \
&& yum clean all
# Install Go
RUN wget https://go.dev/dl/go1.21.6.linux-amd64.tar.gz && \
tar -C /usr/local -xzf go1.21.6.linux-amd64.tar.gz && \
rm go1.21.6.linux-amd64.tar.gz
# Set Go environment variables
ENV PATH="/usr/local/go/bin:${PATH}"
ENV GOPATH="/go"
ENV PATH="${GOPATH}/bin:${PATH}"
# Install AWS SAM CLI
RUN pip install --no-cache-dir aws-sam-cli
# Copy the application code
COPY . /app
# Build the application first
# RUN sam build
# Start the API with debug mode
ENTRYPOINT ["sam", "local", "start-api", "--debug", "--host", "0.0.0.0"]
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I am trying to get sam api running locally in a container but keep hitting roadblocks, I've now gotten as far as Sam building in the container and running. However, whenever trying to connect I get the following:
Watching Docker I can see it spin up another container, but nothing happens, eventually the timeout hits, this message appears and the container disappears.
At a loss as to what to do here, so any help would be appreciated.
DockerFile
Docker Compose
Beta Was this translation helpful? Give feedback.
All reactions