Add an API to Handle Billing

Link to chapter —

When we run the following command, do we expect to see anything in terminal that npx sst start is running?

npx aws-api-gateway-cli-test \
--username='' \
--password='Passw0rd!' \
--user-pool-id='USER_POOL_ID' \
--app-client-id='USER_POOL_CLIENT_ID' \
--cognito-region='COGNITO_REGION' \
--identity-pool-id='IDENTITY_POOL_ID' \
--invoke-url='API_ENDPOINT' \
--api-gateway-region='API_REGION' \
--path-template='/billing' \
--method='POST' \

The thing is that I’m getting 500 - Internal Server Error:

Authenticating with User Pool
Getting temporary credentials
Making API request
  status: 500,
  statusText: 'Internal Server Error',
  data: {
    error: "You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See for details, or we can help at"

So I think that the secret key from env.local is not loading, and hence I put a simple log statement into src/billing.js:


However, I don’t see any log coming out. I also tried the path for GET /notes to list all the notes, and it is successful, however, I’m not getting any log in the npx sst start tab on the terminal either.

You should see it show up in the logs. Was sst start working for you otherwise?

Hi there, I am seeing this same issue. sst start works for me as normal. Can you please advise?

There is also another issue, which is when i hardcode the secret key, i get the following error returned from stripe:

  status: 500,
  statusText: 'Internal Server Error',
  data: { error: 'Invalid token id: tok_visa' }

Hi there, are you still having this issue?

@jayair - Hi there, I am unfortunately and it’s brought me to a grinding hault.

Is this the sst start issue or the Stripe issue?