Skip to content

ECR: do not assume a node runtime for image-based builds #1604

@pkit

Description

@pkit

It's kinda the same problem that was partially fixed in #877
Let's consider a serverless.yml

provider:
  name: aws
  runtime: nodejs18.x
  ecr:
    images:
      python-image:
        path: ./docker/python
functions:
  nodeFunction:
     handler: bla/bla
  pythonFunction:
     image:
       name: python-image
       command: app.handler

What will happen?
It will fail miserably by trying to bundle python code with webpack.
Why?
Because provider.runtime: nodejs18.x doesn't mean that every Dockerfile in provider.ecr.images uses FROM public.ecr.aws/lambda/node:18
But it's silently assumed.
I.e. not only image.urishould be excluded from bundling, but any image that is not derived from public.ecr.aws/lambda/node

Just in case, a sample of ./docker/python/Dockerfile:

FROM public.ecr.aws/lambda/python:3.10

COPY app.py .

CMD ["app.handler"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions