Skip to content

Runtime.ExitError AttributeError: 'NoneType' object has no attribute 'next' #22

Open
@synic

Description

@synic

This is happening to me with the python:3.9-alpine3.12 base image. Here is the Dockerfile:

ARG build_info="head@now"
ARG build_env="development"

FROM python:3.9-alpine3.12 AS base

ARG build_info
ARG build_env

ENV PYTHONPATH=/function
ENV BUILD_INFO=${build_info}

WORKDIR /function
COPY . /function

RUN apk add --no-cache --virtual .build-deps \
    autoconf \
    automake \
    build-base \
    cmake \
    libcurl \
    libexecinfo-dev \
    libstdc++ \
    libtool \
    make \
    postgresql-dev \
    python3-dev \
    && pip install --no-cache-dir -e . \
    && apk del --no-cache .build-deps

FROM base AS build-production
RUN echo " -> Building production image"

FROM base AS build-development
RUN echo " -> Building development image" \
    && apk add --no-cache \
    bash \
    vim \
    iputils \
    && pip3 install --no-cache-dir -e .[debug,testing]

ENV PS1="someapp> "
ENV PYTHONBREAKPOINT=ipdb.set_trace

FROM build-${build_env} AS final

ADD https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie /usr/bin/aws-lambda-rie
COPY entry.sh /
RUN chmod 755 /usr/bin/aws-lambda-rie /entry.sh
ENTRYPOINT [ "/entry.sh" ]
CMD [ "fieldeye.handler" ]

Here's the entry.sh:

#!/bin/sh

if [ -z "${AWS_LAMBDA_RUNTIME_API}" ]; then
    exec /usr/bin/aws-lambda-rie /usr/local/bin/python -m awslambdaric $1
else
    exec /usr/local/bin/python -m awslambdaric $1
fi

and here's the error:

time="2021-02-19T00:09:20.268" level=info msg="exec '/usr/local/bin/python' (cwd=/function, handler=someapp.handler)"
time="2021-02-19T00:09:26.44" level=info msg="extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory"
START RequestId: 724c1d85-78fc-4424-800e-c745e8bd51a1 Version: $LATEST
time="2021-02-19T00:09:26.441" level=warning msg="Cannot list external agents" error="open /opt/extensions: no such file or directory"
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.9/site-packages/awslambdaric/__main__.py", line 21, in <module>
    main(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/awslambdaric/__main__.py", line 17, in main
    bootstrap.run(app_root, handler, lambda_runtime_api_addr)
  File "/usr/local/lib/python3.9/site-packages/awslambdaric/bootstrap.py", line 416, in run
    event_request = lambda_runtime_client.wait_next_invocation()
  File "/usr/local/lib/python3.9/site-packages/awslambdaric/lambda_runtime_client.py", line 76, in wait_next_invocation
    response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'
Executing 'someapp.handler' in function directory '/function'
time="2021-02-19T00:09:26.604" level=warning msg="First fatal error stored in appctx: Runtime.ExitError"
time="2021-02-19T00:09:26.604" level=warning msg="Process 13(python) exited: Runtime exited with error: exit status 1"
time="2021-02-19T00:09:26.604" level=error msg="Init failed" InvokeID= error="Runtime exited with error: exit status 1"
time="2021-02-19T00:09:26.604" level=warning msg="Failed to send default error response: ErrInvalidInvokeID"
time="2021-02-19T00:09:26.604" level=error msg="INIT DONE failed: Runtime.ExitError"
time="2021-02-19T00:09:26.604" level=warning msg="Reset initiated: ReserveFail"

Just to make sure, I ran docker exec -it mycontainer /bin/bash and typed /usr/local/bin/python --version, the response was Python 3.9.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions