Skip to content

Failed to deploy, function code combined with layers exceeds the maximum allowed size of 262144000 bytes #1733

@LazyBrush

Description

@LazyBrush

Describe the bug
Using nestjs with sls to deploy a lambda with otel. I'm using the collector layer to then shuffle telemetry to a S3 bucket for later offline inspection.

When I deploy without the opentelemetry-collector-amd64-0_13_0:1 image layer the AWS console for the lambda says the bundle size is 54.7MB, when I add the layer sls fails to deploy with the error maximum allowed size of 262144000 bytes, the actual size is 264975312 bytes.

If we believe these numbers then it looks like the collector layer is about 210MB or over 80% of max lambda size, some of the documentation says 100MB+

Steps to reproduce
nestjs app as lambda, using otel, deployed with serverless (sls).

What did you expect to see?
My app deployed, nice otel tracing and my heart beating with joy.

What did you see instead?
sls failed to deploy, me crying inside.

What version of collector/language SDK version did you use?
xxx:layer:opentelemetry-collector-amd64-0_13_0:1

What language layer did you use?
Perhaps I am not familiar with the language layer, my guess this give auto instrumentation that wraps your actual code. Instead, I've build my nestjs app with otel sdk, so I am creating spans/metrics/logs manually, so my guess is I do not need a language layer?

Additional context
I can run the nestjs code locally with a docker compose collector and the suite of tools like jaeger, prometheus, etc.

I tried to use webpack to reduce the image size.

I also went down the path of trying to use a container for the lambda, but then layers are not supported, so I would not have the collector layer to shuffle the telemetry to S3.

My main aim is to have a minimal cost solution but still have observability. My thoughts were I could run a lambda without the traditional jaeger/prom/etc tools, just write to S3 logs and then offline or when there was an issue I could spin up those tools on my dev machine to then inspect data in S3.

Happy to have suggestions how best to proceed

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions