Switching from index.js to index.mjs requires a restart
See original GitHub issueDescribe the issue
When you start Sandbox and a route has an index.js
file, renaming that to index.mjs
will cause that route to fail with a cannot a “Lambda handler not found” error until Sandbox is restarted. The reverse (starting up with index.mjs and renaming to index.js) also triggers the same issue.
Steps to reproduce
- Create a new Architect project, add a single HTTP route and start Sandbox.
- Rename
index.js
toindex.mjs
and make the necessary tweaks to be an ESM handler function. - Attempt to load the route in the browser.
Expected behavior Flipping from CommonJS to ESM doesn’t require a Sandbox restart.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Instead change the require of index.js, to a dynamic import ...
I did npm i node-fetch@2.6.1, it seems like it fixed it, then i wrote node utils/nftport/uploadFiles.js in the terminal (dont know the proper ......
Read more >Pinia not working · Issue #6623 · nuxt/framework - GitHub
ERROR Cannot start nuxt: Cannot find module 'pinia/dist/pinia.mjs' 10:34:41 Require stack: - /home/nuxt3/index.js Require stack: - index.js ...
Read more >How To Restart Your Node.js Apps Automatically with nodemon
Step 1 — Installing nodemon. First, you will need to install nodemon on your machine. Install the utility either globally or locally on...
Read more >Automatically restart Node.js apps with Nodemon
The essential tutorial for Nodemon, a utility for Node.js applications that monitors for changes and automatically restarts the server.
Read more >Upgrade your Node app: From CommonJS to ES Modules
I recently ported a midsized, vanilla Node.js app from CommonJS to ES Modules. Here's what I learned and how you can modernize your...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ok, ESM handler provisioning by default is now live in 10.6, hopefully this helps resolve the root issue at hand here!
Ok, getting pretty close! I think this could land as soon as tomorrow. Primary PRs here if you (or anyone) want to futz around with local patching: