triggerfishab / lisa-cli

0 stars 0 forks source link

[Bug]: Handle Sendgrid "user exists" errors. #23

Closed mtws closed 12 months ago

mtws commented 1 year ago

What happened?

Tried to setup Sendgrid by running lisa sendrid create. The command was unsuccessful because of an Sendgrid existing user. The output of was however a bi misguiding since it says the following:

πŸŽ‰ SendGrid account created!
 οΈπŸ’ Add the following values to your vault file or .env:
   tf_smtp_username: "apikey",
   tf_smtp_password: undefined

Lisa CLI status

⚑️ A summary of your Lisa setup

οΈπŸ’ Your path is: /Users/matstuovinen/Workspace οΈπŸ’ Versions of your packages: Ansible: 2.14.3 AWS CLI: 2.10.3 GitHub CLI: 2.23.0 Node: 18.16.0 Trellis CLI: 1.9.0 Valet: 4.0.0 Vercel: 28.16.10 WP CLI: 2.7.1

Relevant log output

βœ” Enter the name of your project … wanda
βœ” Can you confirm that your project name is wanda? … yes
πŸŽ‰ Project name set to wanda

⚑️ Creating Sendgrid subuser

ResponseError: Bad Request
    at /Users/matstuovinen/.nvm/versions/node/v18.16.0/lib/node_modules/@triggerfishab/lisa-cli/node_modules/@sendgrid/client/src/classes/client.js:146:29
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 400,
  response: {
    headers: {
      server: 'nginx',
      date: 'Mon, 12 Jun 2023 09:11:55 GMT',
      'content-type': 'application/json; charset=utf8',
      'content-length': '42',
      connection: 'close',
      'access-control-allow-methods': 'HEAD, GET, PUT, POST, DELETE, OPTIONS, PATCH',
      'access-control-max-age': '21600',
      'access-control-expose-headers': 'Link, Location',
      'access-control-allow-origin': '*',
      'access-control-allow-headers': 'AUTHORIZATION, Content-Type, On-behalf-of, x-sg-elas-acl, X-Recaptcha, X-Request-Source, Browser-Fingerprint',
      'content-security-policy': "default-src https://api.sendgrid.com; frame-src 'none'; object-src 'none'",
      'x-content-type-options': 'nosniff',
      'strict-transport-security': 'max-age=31536000, max-age=600; includeSubDomains',
      'x-client-ff': '1000',
      'x-ratelimit-remaining': '0',
      'x-ratelimit-limit': '1',
      'x-ratelimit-reset': '1686561120',
      'twilio-request-id': 'RQ2R6CP0fGsEaxcrLfk0n1yfGNB0c',
      'x-envoy-upstream-service-time': '424'
    },
    body: { errors: [Array] }
  }
}
[ { message: 'username exists' } ]
🚨 Error setting up Sendgrid subuser
πŸŽ‰ SendGrid account created!
 οΈπŸ’ Add the following values to your vault file or .env:
   tf_smtp_username: "apikey",
   tf_smtp_password: undefined
moelleer commented 12 months ago

Fixed in 3882e7f