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:
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.
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
.jsfile 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:Taking a look at the logs attached to this handler Lambda I saw this error:
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
.mjsfile extension and supports ES6 module exports, however the SST docs still show using Common JS.The text was updated successfully, but these errors were encountered: