Skip to content

bug: Permission denied when accessing binary in lambda layer #8897

@samuelhgf

Description

@samuelhgf

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I'm getting this error when using lambda layer
[Errno 13] Permission denied: '/opt/bin/wkhtmltopdf'

Expected Behavior

Not have Permission Denied

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

```
container_name: localstack
image: localstack/localstack-pro
ports:
  - "4566:4566"
  - "4510-4559:4510-4559"
environment: &aws-env
  AWS_ACCESS_KEY_ID: 12345
  AWS_SECRET_ACCESS_KEY: xyz
  AWS_REGION: us-east-1
  LOCALSTACK_API_KEY: API_KEY
  DEBUG: 1
  PERSISTENCE: 1
  DOCKER_HOST: unix:///var/run/docker.sock
  SERVICES: lambda:4510
volumes:
  - "${LOCALSTACK_VOLUME_DIR:-./volume}:/var/lib/localstack"
  - "/var/run/docker.sock:/var/run/docker.sock"
networks:
  -  atena_network
 ```

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

awslocal s3 mb s3://mybucket

Environment

- OS: MacOS
- LocalStack: latest

Anything else?

My Sam Template:

Transform: AWS::Serverless-2016-10-31

Parameters:
  AppEnv:
    Type: String
    Default: localhost
    AllowedValues:
      - localhost
      - development
      - staging
      - production

Resources:
  Url2PdfS3Function:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src/
      FunctionName: 'url-to-pdf-s3'
      Handler: main.handler
      Runtime: python3.9
      Timeout: 900
      Tracing: Active
      MemorySize: 256
      ReservedConcurrentExecutions: 5
      Environment:
        Variables:
          APP_ENV: !Ref AppEnv
      Tags:
        Name: Utl2PdfS3
      Policies:
        - AWSLambdaBasicExecutionRole
      Layers:
        - !Ref libs

  libs:
    Type: AWS::Serverless::LayerVersion
    Properties:
      LayerName: wkhtmltopdf-lib
      Description: wkhtmltopdf bin.
      ContentUri: wkhtmltopdf/.

And it work properly with localtsack-pro:1.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions