grunge-stack
grunge-stack copied to clipboard
"Lambda handler not found" error due to change in `@architect/architect` v10.6.0
Have you experienced this bug with the latest version of the template?
Yes
Steps to Reproduce
- Upgrade
@architect/architect
to>=10.6
-
npm run dev
- See error (occasionally)
Expected Behavior
Arc sandbox should detect the server file and run without issue.
Actual Behavior
There is a race condition between remix watch
and void arc()
that results in arc intermittently not being able to find the server build artifact. This happens pretty consistently on first boot or if the server/
directory is deleted before the build.
Relevant links: https://github.com/architect/architect/issues/1330 https://github.com/architect/inventory/commit/b890abae17adf741fbe59ee5ae0947ae424bb2e5
Here's my fix in dev.js
. I'm sure there is a cleaner way, but this might help unblock some folks in the meantime:
process.env.PORT = process.env.PORT ?? 3000;
process.env.ARC_LOCAL = process.env.ARC_LOCAL ?? 1;
process.env.ARC_TABLES_PORT = process.env.ARC_TABLES_PORT ?? 5555;
const { watchFile, unwatchFile } = require("fs");
const { join } = require("path");
const arc = require("@architect/architect");
const server = join(__dirname, "server/index.js");
// Wait until the server is built
watchFile(server, { interval: 100 }, (curr, prev) => {
if (!prev.size && curr.size) {
void arc();
unwatchFile(server);
}
});
Just ran into this issue as well and tried the fix @LukeAskew suggested but it didn't work. Restarting the server seemed to fix the problem though.
This issue has been automatically marked stale because we haven't received a response from the original author in a while 🙈. This automation helps keep the issue tracker clean from issues that are not actionable. Please reach out if you have more information for us or you think this issue shouldn't be closed! 🙂 If you don't do so within 7 days, this issue will be automatically closed.
This issue has been automatically closed because we didn't hear anything from the original author after the previous notice.