supertokens/create-supertokens-app

Automatic setup using CLI fails on a DO droplet

Closed this issue · 2 comments

Steps to reproduce:

Step 0: Set up the doctl CLI and install jq.

Step 1: Add a public key to DO.

doctl compute ssh-key import my-key --public-key-file ~/.ssh/id_rsa.pub

Step 2: Create a droplet.

doctl compute droplet create my-droplet --image ubuntu-22-10-x64 --size s-1vcpu-512mb-10gb --region sfo3 --ssh-keys $(doctl compute ssh-key list -o json | jq -r 'map(.id)|@csv') --wait

Step 3: SSH into the droplet.

doctl compute ssh my-droplet

Step 4: Update and install npm.

apt update -y
apt install npm -y

Step 5: Proceed with automatic setup using the CLI, accepting defaults (my-app, React, Node.js).

npx create-supertokens-app@latest --recipe=passwordless

At least when I do this, I get the following error:

✅ Finished setting up folder structure!

⛔ Setup failed!


Error: Killed



Error: If you think this is an issue with the tool, please report this as an issue at https://github.com/supertokens/create-supertokens-app/issues

BTW, folks, I love SuperTokens! Overall, it's great. I just tried this automatic setup thingy for the first time and, well, I hit a snag. Thanks!

Thanks for creating this clear issue @davidaventimiglia. @nkshah2 shall investigate this.

Hi @davidaventimiglia

Thanks for the clear instructions. I was able to re-produce the issue here but it is very DigitalOcean specific so there isnt much we can do to fix this. I did find a workaround though, maybe that works for you too:

The issue mainly occurs because DigitalOcean's environment ends up killing npm install which the CLI runs to setup your frontend and backend (if it is node)

You can follow this: https://www.digitalocean.com/community/questions/npm-gets-killed-no-matter-what to increase the size of the swap file so that npm isnt killed.

After doing that (atleast for me) npm install would fail with JavaScript heap out of memory Errors, to fix that I used export NODE_OPTIONS="--max-old-space-size=4096" to increase the heap size to 4GB (You can adjust the value to find the right one for you, I just used 4GB to test. 2GB didnt work for me but maybe 3 might?)

After that running the CLI worked fine for me. Let me know if that works for you, closing this for now but feel free to re-open.