Skip to content

serverless-offline-sqs configuration issue #5

Closed
@ossareh

Description

Hi there,

I've been playing with offline-sqs and I believe there is a code bug.

The specific line is: https://github.com/godu/serverless/blob/master/packages/serverless-offline-sqs/src/index.js#L38

When you create a queue in AWS there is no trailing '/' in the ARN; which this code expects.

$ aws sqs create-queue --queue-name funtimes
{
    "QueueUrl": "https://us-west-2.queue.amazonaws.com/<acct>/funtimes"
}

$ aws sqs get-queue-attributes --queue-url <url_above> --attribute-names QueueArn
{
    "Attributes": {
        "QueueArn": "arn:aws:sqs:us-west-2:<acct>:funtimes"
    }
}

Reading this code makes me think there should be a URL in the function sqs configurtion, however that is not in line with the serverless docs on the matter

functions:
    funtimes:
        handler: src/funtimes.handler
        events:
            - sqs:
                arn: arn:aws:sqs:us-west-2:<acct>:funtimes

When I use this plugin I get the following error:

[1] (node:20757) UnhandledPromiseRejectionWarning: MissingRequiredParameter: Missing required key 'QueueName' in params
[1]     at ParamValidator.fail (/Users/ossareh/dev/src/code.famfi.co/mono/node_modules/serverless-offline-sqs/node_modules/aws-sdk/lib/param_validator.js:50:37)
[1]     at ParamValidator.validateStructure (/Users/ossareh/dev/src/code.famfi.co/mono/node_modules/serverless-offline-sqs/node_modules/aws-sdk/lib/param_validator.js:61:14)
[1]     at ParamValidator.validateMember (/Users/ossareh/dev/src/code.famfi.co/mono/node_modules/serverless-offline-sqs/node_modules/aws-sdk/lib/param_validator.js:88:21)

The config I have is pretty simple:

custom:
    servleress-offline-sqs:
        region: us-west-2 # without this we get a missing region related error

Also, it's not possible to use a slash in a queue name:

$ aws sqs create-queue --queue-name funtimes/method

An error occurred (InvalidParameterValue) when calling the CreateQueue operation: Can only include alphanumeric characters, hyphens, or underscores. 1 to 80 in length

One thought I had was to allow the user to specify the QueueName directly, you can see this here: ossareh@8da4b47 - however before submitting this to you in a PR I wanted to make sure I'm not missing something obvious.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions