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

[serverless-offline-sqs] Missing QueueName #200

Open
jlgouwyapizr opened this issue Nov 3, 2021 · 11 comments
Open

[serverless-offline-sqs] Missing QueueName #200

jlgouwyapizr opened this issue Nov 3, 2021 · 11 comments

Comments

@jlgouwyapizr
Copy link

jlgouwyapizr commented Nov 3, 2021

Hey folks,

On my side, still have this issue :

Missing required key 'QueueName' in params

I'm using the SDK v3. The last version of serverless offline and offline-sqs.
the serverless-offline-sqs is loaded after serverless-offline.

here is my definition :

    events:
      - sqs:
          arn: { "Fn::Join" : [":", ["arn:aws:sqs:${self:provider.region}", { "Ref" : "AWS::AccountId" }, "${self:provider.stage}-salesforce-customers-update"]]  }
          batchSize: 1

In the SQSEventDefinition file, when we receive the rawSqsEventDefinition , here is the result :

{"arn":{"Fn::Join":[":",["arn:aws:sqs:eu-west-1",{"Ref":"AWS::AccountId"},"local-salesforce-customers-update"]]},"batchSize":1}

The type is object. So it falls to :

if (typeof rawSqsEventDefinition !== 'string') {
      Object.assign(this, omit(['arn', 'queueName', 'enabled'], rawSqsEventDefinition));
}

Which returns :

SQSEventDefinition {
  enabled: true,
  arn: 'arn:aws:sqs:eu-west-1:000000000000:undefined',
  queueName: undefined,
  batchSize: 1
}

So it isn't able to extract correctly.

thanks

@thetumper
Copy link

Having similar issue. Also, not sure why queueName is required? Serverless gives me a warning about it, but serverless-offline-sqs seems to require it. If I remove, serverless is happy, but then the event does not trigger.

@alex88
Copy link

alex88 commented Nov 20, 2021

Same here, I'm trying to use it with serverless-lift and I have the same error, not sure why it's using AWS sdk to create the queue

@plcharriere
Copy link

Same issue here, even when using the serverless configuration example.

@gk1041
Copy link

gk1041 commented Mar 28, 2022

Has there been any progress on this issue?

@eitanfr
Copy link

eitanfr commented May 19, 2022

Same here, using lift

@sandyscoffable
Copy link

+1 using lift

@serg06
Copy link

serg06 commented Jan 4, 2023

Hey all, I just wrote a guide for solving this issue (see above), hope it helps!

@akfreas
Copy link

akfreas commented Feb 8, 2023

For me, the issue was having two queues in the arn: property.

    events:
      - sqs:
          arn:
            !GetAtt MessagingQueue.Arn
            !GetAtt MessagingInternalQueue.Arn

I fixed it by just adding another - sqs event below the first one.

@WNC-Travis
Copy link

Digging into the source code:
https://github.com/CoorpAcademy/serverless-plugins/blob/master/packages/serverless-offline-sqs/src/sqs.js#L85
has queueName as a child of sqs and at the same level as arn.

Something like this got me past this error:

    events:
      - sqs:
          queueName: "MyQueueName"
          arn: { "Fn::Join" : [":", ["arn:aws:sqs:${self:provider.region}", { "Ref" : "AWS::AccountId" }, "${self:provider.stage}-salesforce-customers-update"]]  }
          batchSize: 1

@cfalch
Copy link

cfalch commented May 24, 2023

came here with the same issue and found a workaround, partly thanks to @WNC-Travis for pointing me to the source. His solution also doesn't work for us because queueName gets flagged by the Serverless framework as not valid, and we didn't want to completely disable validation. However,
https://github.com/CoorpAcademy/serverless-plugins/blob/master/packages/serverless-offline-sqs/src/sqs-event-definition.js
will pull queueName off the arn but only if it's type is string. So in our local, we skipped all variable replacement, Fns, pseudo-params and hardcoded the arn as:
arn:aws:sqs:us-east-1:000000000000:our-queue-name
This passes SLS validation and allows serverless-offline-sqs to get a queueName.

@vachannd
Copy link

vachannd commented Jun 7, 2023

I faced similar issue and I realized I put SQS_URL instead of SQS_ARN while defining one of the lambda functions.

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