I already mentioned this but in the wrong channel....
# help
k
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
hm
can you try commenting out the migrations directory and seeing if that fixes?
wondering if it's that
k
Yes, I tried to comment out
migrations: "backend/migrations"
line and then deployment is successful.
t
ok looking into this
can you actually try renaming the migrations from
first.js
->
first.cjs
k
one sec
Nope, the same error. I will try again with a fresh cloned project.
t
trying to create it now
idk how it worked for me locally 😕
a
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
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
Good! I will try deploy it without migrations
t
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
Cool! I managed to generate too many VPCs now cleaning my AWS acc. Can’t make any further tests at the moment.
t
haha sorry about that
I have a list of rds clusters to go back and delete as well
k
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
good call need to flip that back
disabled it for my talk
a
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
Kool
k
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.