Skip to content

Runtime.ExitError #10

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

Closed
devdjdjdj opened this issue Dec 19, 2020 · 4 comments
Closed

Runtime.ExitError #10

devdjdjdj opened this issue Dec 19, 2020 · 4 comments

Comments

@devdjdjdj
Copy link

I am getting the following error when trying to run even the most basic function

START RequestId: eedc7f6f-d42d-4154-9b53-c9d2c984b603 Version: $LATEST
running with python
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/app/awslambdaric/__main__.py", line 21, in <module>
    main(sys.argv)
  File "/home/app/awslambdaric/__main__.py", line 17, in main
    bootstrap.run(app_root, handler, lambda_runtime_api_addr)
  File "/home/app/awslambdaric/bootstrap.py", line 416, in run
    event_request = lambda_runtime_client.wait_next_invocation()
  File "/home/app/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 'app.handler' in function directory '/home/app'
END RequestId: eedc7f6f-d42d-4154-9b53-c9d2c984b603
REPORT RequestId: eedc7f6f-d42d-4154-9b53-c9d2c984b603	Duration: 317.51 ms	Billed Duration: 318 ms	Memory Size: 2000 MB	Max Memory Used: 15 MB	
RequestId: eedc7f6f-d42d-4154-9b53-c9d2c984b603 Error: Runtime exited with error: exit status 1
Runtime.ExitError
@azza-bazoo
Copy link

  File "/home/app/awslambdaric/lambda_runtime_client.py", line 76, in wait_next_invocation
    response_body, headers = runtime_client.next()
AttributeError: 'NoneType' object has no attribute 'next'

I'm seeing this error too -- in my case it's a consequence of trying to run in Python 2 rather than Python 3.

The code in runtime_client.cpp is written for Python 3 (see here), which means it can't be imported in my Python 2 image, which means this line silently sets runtime_client to None.

@carlzogh
Copy link
Contributor

@devdjdjdj thanks for reporting this issue - could you please share your Dockerfile so that we can have a look into what might be going wrong with your function?

@azza-bazoo awslambdaric only supports Python versions 3.6 and up. I highly recommend you try to upgrade your function/application to a more recent Python version that's still being actively supported (Python 2.7 has been officially EOL for over a year now).

@synic
Copy link

synic commented Feb 18, 2021

@carlzogh

This is happening to me with the python:3.8-alpine base image. Here is the Dockerfile:

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

FROM python:3.8-alpine 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-18T23:29:01.443" level=info msg="exec '/usr/local/bin/python' (cwd=/function, handler=someapp.handler)"
time="2021-02-18T23:29:41.978" level=info msg="extensionsDisabledByLayer(/opt/disable-extensions-jwigqn8j) -> stat /opt/disable-extensions-jwigqn8j: no such file or directory"
time="2021-02-18T23:29:41.978" level=warning msg="Cannot list external agents" error="open /opt/extensions: no such file or directory"
START RequestId: 3762b8d2-887d-4f22-89e6-4f8d8905ca5c Version: $LATEST
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/awslambdaric/__main__.py", line 21, in <module>
    main(sys.argv)
  File "/usr/local/lib/python3.8/site-packages/awslambdaric/__main__.py", line 17, in main
    bootstrap.run(app_root, handler, lambda_runtime_api_addr)
  File "/usr/local/lib/python3.8/site-packages/awslambdaric/bootstrap.py", line 416, in run
    event_request = lambda_runtime_client.wait_next_invocation()
  File "/usr/local/lib/python3.8/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'

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

@synic
Copy link

synic commented Feb 19, 2021

I made my own ticket here: #22

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

No branches or pull requests

4 participants