Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: When migration handler throws it does not stop deployment #1838

Open
JohnMarsden24 opened this issue Jun 22, 2022 · 0 comments
Open

Error: When migration handler throws it does not stop deployment #1838

JohnMarsden24 opened this issue Jun 22, 2022 · 0 comments

Comments

@JohnMarsden24
Copy link

@JohnMarsden24 JohnMarsden24 commented Jun 22, 2022

Recently updated SST from 1.0.11 and there seems to have been a changed in the migration functionality. Previously my migration files had a .js file extensions as per the examples at the time. After upgrading and trying to deploy the migration handler was taking a very long time and eventually errored out:

Screenshot 2022-06-22 at 09 49 13

Screenshot 2022-06-22 at 11 19 15

Taking a look at the logs attached to this handler Lambda I saw this error:

module is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and '/var/task/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

I renamed the migration file and viola it worked, however the initial handler that threw the error didn't stop deployment as expected. Instead deployment only stopped after an hour when no response was found, which I imagine was caused by hitting the time limit.

Side note - taking a look at more recent examples I can see the migration files now use .mjs file extension and supports ES6 module exports, however the SST docs still show using Common JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant