https://serverless-stack.com/ logo
#sst
Title
# sst
a

Adrián Mouly

09/19/2021, 7:56 PM
Does SST support API construct to be connected to SQS directly?
o

Omi Chowdhury

09/19/2021, 8:02 PM
I managed to figure out how to do this between APIG V1 and eventbridge in the AWS console, but for the life of me couldn’t figure out the cloudformation YAML syntax do it in in SLS. So I ended up using a lambda to do the forwarding instead. Have notes somewhere on how to configure the headers and mapping templates if anyone wants
a

Adrián Mouly

09/19/2021, 8:03 PM
😞
Trying to figure out how to do with API GW v2.
I mean, HTTP API. Looks like it’s easy with SLS.
But can’t find how to do with SST/CDK yet.
o

Omi Chowdhury

09/19/2021, 8:05 PM
But I figured better to use a solution that looks like the rest of the codebase for other people on my team
a

Adrián Mouly

09/19/2021, 8:06 PM
Looks like this is common with HTTP API integrations.
o

Omi Chowdhury

09/19/2021, 8:13 PM
I think this post has an approach that could be adapted to work for you: https://github.com/aws/aws-cdk/issues/10497#issuecomment-760125780
a

Adrián Mouly

09/19/2021, 8:14 PM
Oh interesting.
This uses low level CFN classes.
Makes sense.
o

Omi Chowdhury

09/19/2021, 8:14 PM
And this PR to add it as a higher level construct is in process: https://github.com/aws/aws-cdk/pull/16287
a

Adrián Mouly

09/19/2021, 8:14 PM
Amazing!
I was looking for that 😍
f

Frank

09/19/2021, 11:05 PM
Hey guys, yeah, we have an open issue for this.. waiting for CDK to add high level support for it - https://github.com/serverless-stack/serverless-stack/issues/565
a

Adrián Mouly

09/19/2021, 11:06 PM
Thanks @Frank.
Going to try the low level stuff.
I’m using this..
Copy code
new CfnIntegration(this, 'yabbleSurveyResponsesApiIntegration', {
      apiId: surveyResponsesApi.httpApiId,
      integrationType: 'AWS_PROXY',
      integrationSubtype: 'SQS-SendMessage',
      //   credentialsArn: role.roleArn,
      requestParameters: {
        Source: 'Gateway',
        Detail: '$request.body',
        DetailType: 'api-call',
        QueueUrl: surveyResponsesToProcessQueue.sqsQueue.queueUrl,
      },
      payloadFormatVersion: '1.0',
      timeoutInMillis: 10000,
    });
Do you see anything wrong?
Not sure about the parameters for SQS.