{"action":"created","issue":{"url":"https://api.github.com/repos/godu/serverless/issues/5","repository_url":"https://api.github.com/repos/godu/serverless","labels_url":"https://api.github.com/repos/godu/serverless/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/godu/serverless/issues/5/comments","events_url":"https://api.github.com/repos/godu/serverless/issues/5/events","html_url":"https://github.com/godu/serverless/issues/5","id":351653688,"node_id":"MDU6SXNzdWUzNTE2NTM2ODg=","number":5,"title":"serverless-offline-sqs configuration issue","user":{"login":"ossareh","id":260015,"node_id":"MDQ6VXNlcjI2MDAxNQ==","avatar_url":"https://avatars1.githubusercontent.com/u/260015?v=4","gravatar_id":"","url":"https://api.github.com/users/ossareh","html_url":"https://github.com/ossareh","followers_url":"https://api.github.com/users/ossareh/followers","following_url":"https://api.github.com/users/ossareh/following{/other_user}","gists_url":"https://api.github.com/users/ossareh/gists{/gist_id}","starred_url":"https://api.github.com/users/ossareh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ossareh/subscriptions","organizations_url":"https://api.github.com/users/ossareh/orgs","repos_url":"https://api.github.com/users/ossareh/repos","events_url":"https://api.github.com/users/ossareh/events{/privacy}","received_events_url":"https://api.github.com/users/ossareh/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-17T16:12:03Z","updated_at":"2018-08-29T22:27:18Z","closed_at":null,"author_association":"NONE","body":"Hi there,\r\n\r\nI've been playing with offline-sqs and I believe there is a code bug.\r\n\r\nThe specific line is: https://github.com/godu/serverless/blob/master/packages/serverless-offline-sqs/src/index.js#L38\r\n\r\nWhen you create a queue in AWS there is no trailing '/' in the ARN; which this code expects.\r\n\r\n```\r\n$ aws sqs create-queue --queue-name funtimes\r\n{\r\n    \"QueueUrl\": \"https://us-west-2.queue.amazonaws.com/<acct>/funtimes\"\r\n}\r\n\r\n$ aws sqs get-queue-attributes --queue-url <url_above> --attribute-names QueueArn\r\n{\r\n    \"Attributes\": {\r\n        \"QueueArn\": \"arn:aws:sqs:us-west-2:<acct>:funtimes\"\r\n    }\r\n}\r\n```\r\n\r\nReading 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](https://serverless.com/framework/docs/providers/aws/events/sqs/)\r\n\r\n```\r\nfunctions:\r\n    funtimes:\r\n        handler: src/funtimes.handler\r\n        events:\r\n            - sqs:\r\n                arn: arn:aws:sqs:us-west-2:<acct>:funtimes\r\n```\r\n\r\nWhen I use this plugin I get the following error:\r\n\r\n```\r\n[1] (node:20757) UnhandledPromiseRejectionWarning: MissingRequiredParameter: Missing required key 'QueueName' in params\r\n[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)\r\n[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)\r\n[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)\r\n```\r\n\r\nThe config I have is pretty simple:\r\n\r\n```\r\ncustom:\r\n    servleress-offline-sqs:\r\n        region: us-west-2 # without this we get a missing region related error\r\n```\r\n\r\nAlso, it's not possible to use a slash in a queue name:\r\n\r\n```\r\n$ aws sqs create-queue --queue-name funtimes/method\r\n\r\nAn error occurred (InvalidParameterValue) when calling the CreateQueue operation: Can only include alphanumeric characters, hyphens, or underscores. 1 to 80 in length\r\n```\r\n\r\nOne thought I had was to allow the user to specify the QueueName directly, you can see this here: https://github.com/ossareh/serverless/commit/8da4b4735f7080674f1867e98827dbddc94c191b - however before submitting this to you in a PR I wanted to make sure I'm not missing something obvious."},"comment":{"url":"https://api.github.com/repos/godu/serverless/issues/comments/417127307","html_url":"https://github.com/godu/serverless/issues/5#issuecomment-417127307","issue_url":"https://api.github.com/repos/godu/serverless/issues/5","id":417127307,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzEyNzMwNw==","user":{"login":"godu","id":509108,"node_id":"MDQ6VXNlcjUwOTEwOA==","avatar_url":"https://avatars1.githubusercontent.com/u/509108?v=4","gravatar_id":"","url":"https://api.github.com/users/godu","html_url":"https://github.com/godu","followers_url":"https://api.github.com/users/godu/followers","following_url":"https://api.github.com/users/godu/following{/other_user}","gists_url":"https://api.github.com/users/godu/gists{/gist_id}","starred_url":"https://api.github.com/users/godu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/godu/subscriptions","organizations_url":"https://api.github.com/users/godu/orgs","repos_url":"https://api.github.com/users/godu/repos","events_url":"https://api.github.com/users/godu/events{/privacy}","received_events_url":"https://api.github.com/users/godu/received_events","type":"User","site_admin":false},"created_at":"2018-08-29T22:27:18Z","updated_at":"2018-08-29T22:27:18Z","author_association":"OWNER","body":"@ossareh Hi,\r\n\r\nYou're right, the configuration process is weird. Adding a option should be the first strategy to resolve QueueName, then extract it from ARN if option is missing.\r\n\r\nI'll fix extracting method to support `/` charactere.\r\n\r\nCould you propose a PR to add QueueName option ? "}}
{"actor":{"display_login":"godu"}}