https://serverless-stack.com/ logo
#help
Title
# help
k

kritstabs

05/25/2022, 4:42 PM
I already mentioned this but in the wrong channel. I tried to start “ideal stack preview” but Database stack stucks in “CREATE_IN_PROGRESS” state. I tried node14, node16. SST: 1.2.3 CDK: 2.24.0. This is the error from rdsMigrationHandler lambda logs:
Copy code
2022-05-25T16:08:35.058Z	undefined	ERROR	Uncaught Exception 	{
    "errorType": "Runtime.UserCodeSyntaxError",
    "errorMessage": "SyntaxError: Cannot use import statement outside a module",
    "stack": [
        "Runtime.UserCodeSyntaxError: SyntaxError: Cannot use import statement outside a module",
        "    at _loadUserApp (file:///var/runtime/index.mjs:724:17)",
        "    at async Object.module.exports.load (file:///var/runtime/index.mjs:741:21)",
        "    at async file:///var/runtime/index.mjs:781:15",
        "    at async file:///var/runtime/index.mjs:4:1"
    ]
}
t

thdxr

05/25/2022, 4:46 PM
hm
can you try commenting out the migrations directory and seeing if that fixes?
wondering if it's that
k

kritstabs

05/25/2022, 4:48 PM
Yes, I tried to comment out
migrations: "backend/migrations"
line and then deployment is successful.
t

thdxr

05/25/2022, 4:50 PM
ok looking into this
can you actually try renaming the migrations from
first.js
->
first.cjs
k

kritstabs

05/25/2022, 4:51 PM
one sec
Nope, the same error. I will try again with a fresh cloned project.
t

thdxr

05/25/2022, 5:09 PM
trying to create it now
idk how it worked for me locally 😕
a

AR

05/25/2022, 5:14 PM
getting the same thing after switching those files to
.cjs
. i tried running a
sst remove
to clear the project but likewise it won't let me remove that stack either with similar error:
Copy code
❌  dev-my-sst-app-Database failed: Error: Stack dev-my-sst-app-Database is in the CREATE_IN_PROGRESS state. It cannot be destroyed.
t

thdxr

05/25/2022, 5:14 PM
might have to force delete it from cfn console
I'm running up a fresh stage to see what's going on
ah you know what, the migrations were working for me because they were executing locally
that folder was empty when I first deployed
k

kritstabs

05/25/2022, 5:17 PM
Good! I will try deploy it without migrations
t

thdxr

05/25/2022, 5:34 PM
yeah looks like we have a bug in our migrator when bringing up the db for the first time while also having migrations to run, work around is to delete the migrations until it's up once
turns out I was looking in the wrong place
about to release 1.2.6 with a fix
cc @AR
k

kritstabs

05/25/2022, 6:37 PM
Cool! I managed to generate too many VPCs now cleaning my AWS acc. Can’t make any further tests at the moment.
t

thdxr

05/25/2022, 6:38 PM
haha sorry about that
I have a list of rds clusters to go back and delete as well
k

kritstabs

05/25/2022, 6:39 PM
Sometimes AWS fights back and don’t allow to delete things 😞
Btw, for Ideal stack demo I propose to set RDS `autoPause=true’ to avoid unexpected expenses.
t

thdxr

05/25/2022, 6:41 PM
good call need to flip that back
disabled it for my talk
a

AR

05/25/2022, 9:11 PM
thanks @thdxr! working on a fresh build so far (database built and migration lambda ran w/o a hitch after upgrading to latest sst)
t

thdxr

05/25/2022, 9:11 PM
Kool
k

kritstabs

05/26/2022, 8:58 AM
Yep, updated SST to the latest version and it works now. 👍
Now I got a new error when running SST deploy command. What I did: • cloned project •
yarn sst start
and it deployed without errors • Applied first and second migration through SST console •
yarn sst deploy
and got the following error message in
rdsMigrationFunction
logs
Copy code
2022-05-26T09:30:29.734Z	0921227a-9d23-4f2f-8083-a59dfdac75f8	ERROR	Invoke Error 	{
    "errorType": "Error",
    "errorMessage": "corrupted migrations: previously executed migration first. is missing",
    "stack": [
        "Error: corrupted migrations: previously executed migration first. is missing",
        "    at Migrator.ensureMigrationsNotCorrupted_fn (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:6237:13)",
        "    at Migrator.getState_fn (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:6215:89)",
        "    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
        "    at async run (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:6187:21)",
        "    at async _TransactionBuilder.execute (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:5102:22)",
        "    at async Migrator.migrate_fn (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:6120:12)",
        "    at async Runtime.handler (/var/task/Users/kristaps/projects/ideal-stack-preview/node_modules/@serverless-stack/resources/dist/RDS_migrator/index.js:7391:20)"
    ]
}
PS. Is it intended to always run sst deploy command on “prod” stage? When I run it on non existing stage
yarn sst deploy --stage random
then I don’t see that error. Thanks.
6 Views