lift icon indicating copy to clipboard operation
lift copied to clipboard

Trying to use other serverless tool commands causes issue with serverless-wsgi

Open babyhuey opened this issue 3 years ago • 5 comments

Description

When I try to run a command from serverless-wsgi, it is throwing an error from lift.

sls -s dev wsgi manage --command "migrate"
 
 Error ---------------------------------------------------
 
  Error: Constructs are already initialized: this should not happen
      at _LiftPlugin.loadConstructs (/code/mmasync-sqs-poc/node_modules/serverless-lift/dist/src/plugin.js:175:13)
      at initialize (/code/mmasync-sqs-poc/node_modules/serverless-lift/dist/src/plugin.js:92:14)
      at PluginManager.run (/usr/lib/node_modules/serverless/lib/classes/PluginManager.js:648:65)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  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.18.2
     Framework Version:         2.65.0
     Plugin Version:            5.5.3
     SDK Version:               4.3.0
     Components Version:        3.18.1

How to Reproduce

service: async-serverless

provider:
  name: aws
  runtime: python3.8
  vpc:
    securityGroupIds: ${file(config-${opt:stage}.yaml):securityGroups}
    subnetIds: ${file(config-${opt:stage}.yaml):subnets}
plugins:
  - serverless-wsgi
  - serverless-python-requirements
  - serverless-prune-plugin
  - serverless-lift

constructs:
    jobs:
        type: queue
        worker:
            handler: mmasync.lambdas.async_task_handler
            environment:
              DJANGO_SETTINGS_MODULE: sqspoc.settings

custom:
  wsgi:
    app: sqspoc.wsgi.application
functions:
  app:
    handler: wsgi_handler.handler
    timeout: 30
    events:
      - http:
          path: /{proxy+}
          method: any
    environment:
      MMASYNC_SQS_QUEUE_NAME: ${construct:jobs.queueUrl}

Additional Information

sls --version Framework Core: 2.65.0 Plugin: 5.5.3 SDK: 4.3.0 Components: 3.18.1

babyhuey avatar Jan 10 '22 21:01 babyhuey

Any status on this? It's still an issue for us

babyhuey avatar Feb 09 '22 19:02 babyhuey

Hi, I haven't worked on that so far. Have you tried maybe loading the Lift plugin before the other plugins? It might be worth a shot.

mnapoli avatar Feb 09 '22 20:02 mnapoli

I just tried putting lift at the top and it's still happening :(

babyhuey avatar Feb 09 '22 20:02 babyhuey

Any update on this?

cristiansandru11 avatar Jul 20 '22 09:07 cristiansandru11

Any update on this? I'm still having to do this every time I run a command

    - sed -e '/serverless-lift/ s/^#*/#/' -i serverless.yml || true 
    - sed -e '/construct:job/ s/^#*/#/' -i serverless.yml || true

babyhuey avatar Dec 13 '23 15:12 babyhuey