Why creating a Stripe customer.id fails within AWS Lambda?

Viewed 233

I am using the Stripe/NodeJS library to generate a Stripe customer id when a user is created:

const stripe = require('stripe')(process.env.STRIPE_SECRET_KEY);

exports.handler = async (event, context) => {
 const newUser = JSON.parse(event.body);

 const customer = await stripe.customers.create({
  email: newUser.emailAddress,
 });

 return customer.id;
};

I thought that the code is pretty straightforward and almost a duplicate to the library's README example, however, the lambda execution hits the stripe.customers.create and never completes, the lambda eventually times out (the lambda is NodeJS 12.x).

Thoughts on what I am missing in order to get this to work?

0 Answers
Related