I’m using [email protected] to deploy my services, and I’m looking at setting up an HTTP API Proxy to an SQS Service.
I’ve handled this previously through this plugin – serverless-apigateway-service-proxy. Unfortunately this sets up the proxy through a REST API. I don’t need all the features from a REST API, so I’m looking at setting up a HTTP API Proxy to SQS.
I’ve used these resources to help me set up:
- https://blog.deleu.dev/receiving-sqs-messages-via-api-gateway/
- https://awsteele.com/blog/2021/09/06/api-gateway-http-apis-and-sqs-messageattributes.html
But I’m consistently getting a 400 error
Operation: SQS-SendMessage is not supported. (Service: AmazonApiGatewayV2; Status Code: 400;
Here’s the snippet for the Integration.
Integration:
Type: AWS::ApiGatewayV2::Integration
Properties:
ApiId: ${param:HttpAPIRef}
IntegrationSubtype: SQS-SendMessage
IntegrationType: AWS_PROXY
ConnectionType: INTERNET
PayloadFormatVersion: 1.0
CredentialsArn: !GetAtt HttpApiRole.Arn
RequestParameters:
QueueUrl: !Ref Queue
MessageBody: random+text
I successfully created an Integration through the AWS Console and the aws cli. This is the only workaround. But it’s a pain to maintain as you might see
- Create the integration on the Console or CLI
- Reference the integration id through custom parameters
A pain when referencing across different environments
Any idea why I would get this error through Cloudfromation?
Also, any way I can debug this further? I’m fairly new to AWS, so I’m learning as I’m going 🙂
Here’s a screenshot of the error on AWS Console:
2
Answers
Found my issue!
PayloadFormatVersion should be a string.
Your error message doesn’t match your
Resource
configuration. The stack from the second link actually works, so you must be creating a problem in some other way, or aren’t looking at the latest error for the stack.I just tried this stack and it 100% works: