Skip to content
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

Python lambda function created inside a queue does not install requirements.txt file #358

Open
Pixcell opened this issue Sep 6, 2023 · 1 comment

Comments

@Pixcell
Copy link

Pixcell commented Sep 6, 2023

Hello,

Using lift queue construct, the created lambda does not include dependencies defined inside a requirements.txt file that can be found at the root of the folder containing the handler.

Folder struct:

src/
  artefacts/
     exporter/
        handler.py
        ....
        requirements.txt

serverless definition:

plugins:
  - serverless-python-requirements
  - serverless-prune-plugin
  - serverless-lift
 
 ....
 
constructs:
  rqd-export-artefacts:
    type: queue
    maxConcurrency: 5
    worker:
      role: ArtefactExporterRole
      handler: src/artefact/exporter/handler.handle
      timeout: 600
      environment:
        ...
    batchSize: 10

Any help would be greatly appreciated.
I tried using layers, but I must be doing something wrong because the layer wont package with the error

Serverless: Configuration warning:
Serverless:   at 'functions.orchestrator_initialise': unrecognized property 'module'
Serverless:   at 'functions.orchestrator': unrecognized property 'module'
Serverless:  
Serverless: Learn more about configuration validation here: http://slss.io/configuration-validation
Serverless:  
Serverless: Generated requirements from /root/project/src/orchestrator/requirements.txt in /root/project/.serverless/src/orchestrator/requirements.txt...
Serverless: Installing requirements from /root/.python_library_cache/a1a842adba81ba6d4a86733fbadb121a75b89db3348d803d00ba75024ecf76b8_slspyc/requirements.txt ...
Serverless: Using download cache directory /root/.python_library_cache/downloadCacheslspyc
Serverless: Running ...
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
Serverless: Excluding development dependencies...
 
 Serverless Error ----------------------------------------
 
  No file matches include / exclude patterns
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              14.21.3
     Framework Version:         2.63.0 (local)
     Plugin Version:            5.4.8
     SDK Version:               4.3.0
     Components Version:        3.17.1
 

Exited with code exit status 1

Thank you!

@mnapoli
Copy link
Member

mnapoli commented Sep 8, 2023

Hi, could it be that the python plugin runs after Lift declares the "worker" function? (and so the Python plugin doesn't detect the worker function)

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

2 participants