AWS Lambda with Serverless Framework not deploying Lambda Layers properly
I've been banging my head against this for hours. I've searched everywhere and can't find a clear answer. I'm prototyping a solution and Quick question that's been bugging me - I'm experiencing issues with deploying AWS Lambda Layers using the Serverless Framework. While my function works perfectly on its own, when I try to add a Lambda Layer that includes the `axios` library, I encounter the following behavior during deployment: `behavior: The role defined for the function want to be assumed by Lambda`. I've tried configuring the IAM role, but it seems like the Lambda Layer isn't being included correctly. Hereโs my `serverless.yml` configuration: ```yaml service: my-service provider: name: aws runtime: nodejs14.x functions: myFunction: handler: handler.myFunction layers: - { Ref: MyLayer } resources: Resources: MyLayer: Type: 'AWS::Lambda::LayerVersion' Properties: LayerName: my-layer Description: A layer for common libraries Content: S3Bucket: my-bucket S3Key: my-layer.zip CompatibleRuntimes: - nodejs14.x LicenseInfo: MIT ``` In my `package.json`, I make sure to package the required libraries: ```json { "name": "my-service", "version": "1.0.0", "dependencies": { "axios": "^0.21.1" } } ``` I've tried updating the Serverless Framework to the latest version (2.58.0) and ensured that my IAM user has the right policies attached, including `AWSLambda_FullAccess` and `AWSLambda_ReadOnlyAccess`. Still, the layer doesnโt seem to be deployed correctly. Has anyone faced similar issues with Lambda Layers in Serverless, and how did you resolve them? For context: I'm using Javascript on Ubuntu. Am I missing something obvious? This is part of a larger service I'm building. How would you solve this? I'm working on a service that needs to handle this. What am I doing wrong? Thanks for your help in advance! I'm developing on Ubuntu 22.04 with Javascript. I'd really appreciate any guidance on this.