Webiny-js: API deploy hangs on s3 bucket creation if project name includes capital letters

Created on 6 Oct 2020  Â·  6Comments  Â·  Source: webiny/webiny-js

This is a:

  • Bug


Specifications

  • version: 4.13.0
  • OS: OS X Catalina 10.15.6
  • Browser: All (command line, not browser issue)

Expected Behavior

If I try to deploy an API stack with an invalid project name, the deploy should error and tell me to choose another, valid, name.

Actual Behavior

The deploy hangs at this step instead:

  webiny:filesBucket Deploying bucket '07October2020B-tinynews-contentapi-prod' in region 'us-east-1' +0ms
  webiny:filesBucket Checking if bucket 07October2020B-tinynews-contentapi-prod exists. +12ms
  webiny:filesBucket Bucket 07October2020B-tinynews-contentapi-prod does not exist. Creating... +1s
  webiny:filesBucket Setting CORS for bucket '07October2020B-tinynews-contentapi-prod' +1s
  508s › Deploying...

Steps to Reproduce the Problem


  1. Set your API's S3_BUCKET name to something with a capital letter like my example above api/.env.json
  2. Try to deploy the API stack yarn webiny deploy api --env=prod
  3. It should hang at the create S3 bucket/CORS step

Detailed Description

It looks like the bucket never gets created. I finally figured out that AWS doesn't let you create a bucket with a capital letter by trying to create it in the management console. (AWS error: Bucket name must not contain uppercase characters)

See code here: https://github.com/webiny/webiny-js/blob/fc87f378f4ecfc343de5e6a2feaef634006a5091/packages/serverless-aws-s3/utils.js#L44-L50

Possible Solution

So, this turned out to be an error on my part for sure. However, I would have expected the deploy to fail and pass on the error message from AWS instead of hanging. I'm not sure what error if any is returned by await s3.createBucket({ Bucket: name }).promise(); so perhaps the answer is somewhere in that aws call?

Thanks! I'm on the webiny slack and happy to elaborate on this if necessary.

bug

All 6 comments

Thanks @jacqui, will check this for the next week's release.

Feel free to take a look @ng29, if you need any help, let us know.

Let us know if you need any help @ng29.

Thanks!

Let us know if you need any help @ng29.

Thanks!

hiya @doitadrian I didn't get much time to look into it, but some starter points will be very appreciated.(Possible root cause)

Cheers

Hi @ng29, you can put a check here (above the debug("Checking if...): https://github.com/webiny/webiny-js/blob/fc87f378f4ecfc343de5e6a2feaef634006a5091/packages/serverless-aws-s3/utils.js#L41

So, if the name of the S3 bucket starts with an upper case, just throw an error with an appropriate error message.

Let's see if that will work.

You can also add your own debug message before doing the actual check, for example: debug("Checking the bucket name...").

Hi @ng29, you can put a check here (above the debug("Checking if...):

https://github.com/webiny/webiny-js/blob/fc87f378f4ecfc343de5e6a2feaef634006a5091/packages/serverless-aws-s3/utils.js#L41

So, if the name of the S3 bucket starts with an upper case, just throw an error with an appropriate error message.

Let's see if that will work.

You can also add your own debug message before doing the actual check, for example: debug("Checking the bucket name...").

Thanks a lot, @doitadrian for these pointers, really helpful .. Will cook this up today
(Just a heads up, may ping you on slack if more queries)

Cheers

Was this page helpful?
0 / 5 - 0 ratings

Related issues

doitadrian picture doitadrian  Â·  4Comments

Pavel910 picture Pavel910  Â·  6Comments

icy-meteor picture icy-meteor  Â·  4Comments

Pavel910 picture Pavel910  Â·  5Comments

tjrexer picture tjrexer  Â·  7Comments