getlift / lift

Expanding Serverless Framework beyond functions using the AWS CDK
MIT License
913 stars 108 forks source link

Using serverless-offline-sqs #101

Open andrereliquias opened 2 years ago

andrereliquias commented 2 years ago

I'm currently on a project where I'm using the following plugins: serverless-offline, serverless-offline-sqs and serverless-lift. When I try to run 'serverless offline', for each environment declared in the worker this error is being raised:

offline: MissingRequiredParameter: Missing required key 'QueueName' in params at ParamValidator.fail.

Is there any configuration where I can fix this error?

mnapoli commented 2 years ago

Hi, just to be sure: do you load serverless-offline-sqs after serverless-offline in serverless.yml? (see https://github.com/CoorpAcademy/serverless-plugins/issues/5#issuecomment-646893597)

If that still doesn't solve your problem, I see that this PR might help: https://github.com/CoorpAcademy/serverless-plugins/pull/6 It isn't documented but it seems to be:

custom:
  serverless-offline-sqs:
    QueueName: abc
alex88 commented 2 years ago

I gave it a try using:

constructs:
  my-queue:
    type: queue
    worker:
      handler: queue.handler
      memorySize: 512
      timeout: 10

custom:
  serverless-offline:
    useChildProcesses: true
  serverless-offline-sqs:
    autoCreate: true
    apiVersion: '2012-11-05'
    endpoint: http://0.0.0.0:9324
    region: eu-west-1
    accessKeyId: root
    secretAccessKey: root
    skipCacheInvalidation: false

plugins:
  - serverless-lift
  - serverless-offline
  - serverless-offline-sqs

the app now starts (serverless-offline-sqs doesn't create the queue in elasticMq though, even when using QueueName). The problem is that when trying to push the messages I get:

{
    "errorMessage": "Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1",
    "errorType": "Error",
    "stackTrace": [
        "Error: connect EHOSTUNREACH 169.254.169.254:80"
    ]
}

has anyone ever been able to get it to work?

Update: nvm it seems that we have to wait for #93 anyway

gravi2 commented 2 years ago

@alex88 did you find any work around for this?

alex88 commented 2 years ago

@gravi2 unfortunately not, ended up not using serverless and making a regular app

eitanfr commented 1 year ago

any updates about this issue?

moioo91120 commented 8 months ago

Hello, any updates ? I tried to use the "extensions" without sucess. Like

  constructs: {
    QueueJob: {
      type: 'queue',
      fifo: 'true',
      worker: {
        handler: 'src/job/job.handler',
      },
      extensions: {
        queue: {
          QueueName: 'Hello',
        },
        dlq: {
          QueueName: 'Hello dlq',
        },
      },
    },
  },

Error is still "MissingRequiredParameter: Missing required key 'QueueName' in params"