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

New serverless pattern - Stripe-EventBridge-Lambda #2297

Conversation

MutantMedal
Copy link

Issue #, if available:

Description of changes:

This pattern demonstrates how to use the Stripe Amazon EventBridge SaaS integration and AWS Lambda to process events from Stripe.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pputhran
Copy link
Contributor

This would be useful to be submitted under the repo as an example. Please submit this to the repos directory at serverlessland.com/repos.

@pputhran pputhran closed this Jun 24, 2024
@pputhran pputhran reopened this Jul 15, 2024
```
3. From the command line, use AWS CDK to deploy the AWS resources for the pattern as specified in the app.py file. A command-line argument is needed to deploy the CDK stack, "stripeEventBusName". This argument should be the name of the **SaaS event bus** associated with your Stripe [partner event source](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-saas.html).
```
cdk deploy --parameters stripeEventBusName=SAAS_EVENT_BUS_NAME_HERE
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this missing any instructions? I am getting the below error

/serverless-patterns/stripe-eventbridge-lambda/app.py", line 3, in
import aws_cdk as cdk
ModuleNotFoundError: No module named 'aws_cdk'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so, I do not see that error

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me take a deeper look

@@ -0,0 +1,61 @@
{
"title": "Stripe EvenBridge SaaS Integration to AWS Lambda",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"title": "Stripe EvenBridge SaaS Integration to AWS Lambda",
"title": "Amazon EventBridge Stripe SaaS Integration to AWS Lambda",

@@ -0,0 +1,61 @@
{
"title": "Stripe EvenBridge SaaS Integration to AWS Lambda",
"description": "Stripe Failed Payment Event Monitoring and Archiving Solution using AWS EventBridge and CDK",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it specific to failed payments? Can this pattern be extended to cover additional use-cases?

Comment on lines +64 to +65
aws lambda invoke --function-name <StripeIntegrationStack-StripeProcessFailedPaymentL-nIPhn7sPQx9e> --payload file://event.json response.json
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to add --cli-binary-format raw-in-base64-out because the input is expected to be in base64

Comment on lines +69 to +72
{
"StatusCode": 200,
"ExecutedVersion": "$LATEST"
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get an error message instead (account id redacted):

{"statusCode": 500, "body": "An error occurred (AccessDeniedException) when calling the PutItem operation: User: arn:aws:sts::123456789012:assumed-role/StripeIntegrationStack-stripecdklambdarole246618B3-lLn1HaA8rFMz/StripeIntegrationStack-StripeProcessFailedPaymentL-BwLehI3Ed8BA is not authorized to perform: dynamodb:PutItem on resource: arn:aws:dynamodb:eu-west-1:123456789012:table/StripeIntegrationStack-StripeFailedPaymentsTableC8BBF5D3-SSP3IAPIWRPJ because no identity-based policy allows the dynamodb:PutItem action"}%


2. From the Event bus list, choose the SaaS event bus associated with your Stripe partner event source.

3. From the Rules list, select the "StripeIntegrationStack-StripeFailedPaymentEventsRul-cSTSp1wtPkkB"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The suffix is randomly generated and will not match the users resources. It's probably better to word this differently

@bfreiberg
Copy link
Contributor

Hi, do you still plan to address the requested changes?

@bfreiberg
Copy link
Contributor

Closing due to inactivity

@bfreiberg bfreiberg closed this Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants