Closed urimerhav closed 1 year ago
Looks like when we install any additional dependency, the docker container doesn't actually install the new dependency somehow.
My setup works on local (shopify dev works). But the backend crashes on both heroku and fly.io over mongodb module not found.
Here's my backend package.json
{ "dependencies": { "@shopify/app": "3.45.4", "@shopify/cli": "3.45.4", "mongodb": "^5.5.0" }, "author": "urimerchav" }
I do see that the docker file runs npm install, so no idea why it's actually failing.
For reference, here's the crash logs from fly.io
2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'mongodb' imported from /app/db.js 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at new NodeError (node:internal/errors:399:5) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at packageResolve (node:internal/modules/esm/resolve:889:9) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at moduleResolve (node:internal/modules/esm/resolve:938:20) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at defaultResolve (node:internal/modules/esm/resolve:1153:11) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at nextResolve (node:internal/modules/esm/loader:163:28) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at ESMLoader.resolve (node:internal/modules/esm/loader:838:30) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40) 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] at link (node:internal/modules/esm/module_job:76:36) { 2023-05-19T14:46:53.961 app[3d8d99e4b96589] bos [info] code: 'ERR_MODULE_NOT_FOUND'
Haha, never mind. I now realize there's NESTED package.json's in this repo. The outer most package json isn't actually being copied over and deployed by docker, which makes sense.
Looks like when we install any additional dependency, the docker container doesn't actually install the new dependency somehow.
My setup works on local (shopify dev works). But the backend crashes on both heroku and fly.io over mongodb module not found.
Here's my backend package.json
I do see that the docker file runs npm install, so no idea why it's actually failing.
For reference, here's the crash logs from fly.io