I’m trying to deploy my project to Netlify but face the below error. The error seems to happen when Netlify tries to package the server-side code. Is this error related to redwoodjs or is it a Netlify issue?
Hi @dnprock I think the issue here is the location of the /viz directory. The Netlify deploy is configured to build and deploy functions via Netlify Lambdas, which does not include static files. You can emulate the Netlify build and deploy process locally via this doc. Zip it and Ship it handles the Lambda functions.
I think you’d be best off moving the files from viz/ into web/public. Here’s our document on handling assets and files. However, then you’ll be in a strange situation where the Lamba functions are loading data from your static files deployed on Netlify’s CDN. This might work but, honestly, I’m not sure. You probably don’t need an API for this app, as it seems you could move all the logic in vizjson.js into web/.
(Another idea could be to store them in AWS S3 or other cloud storage. But they are very small files and should be fine to deploy with web/.)
Lastly, because you’re not using a DB (and you might not even use an API), you’ll need to modify the Netlify build and deploy scripts further. (Currently, the scripts will always try to build Prisma DB Connection and fail if they can’t.) Here’s a forum topic with an example for deploying without DB. If you decide to deploy without an API, you’ll just need to update the netlify.toml to only build the web and not handle functions.
Keep me posted! And let me know if you have any further questions.
@thedavid thanks. I switch to using we/public folder. It’s working well locally. I got passed disable db step. Now Netlify is throwing me a 502 error. Any suggestion to fix this?
The Function log error is:
1:43:54 PM: 2020-04-29T20:43:54.837Z undefined ERROR Uncaught Exception {“errorType”:“Runtime.ImportModuleError”,“errorMessage”:“Error: Cannot find module ‘@babel/runtime-corejs3/helpers/interopRequireWildcard’\nRequire stack:\n- /var/task/graphql.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js”,“stack”:[“Runtime.ImportModuleError: Error: Cannot find module ‘@babel/runtime-corejs3/helpers/interopRequireWildcard’”,“Require stack:”,"- /var/task/graphql.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js"," at _loadUserApp (/var/runtime/UserFunction.js:100:13)"," at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)"," at Object. (/var/runtime/index.js:43:30)"," at Module._compile (internal/modules/cjs/loader.js:1158:30)"," at Object.Module._extensions…js (internal/modules/cjs/loader.js:1178:10)"," at Module.load (internal/modules/cjs/loader.js:1002:32)"," at Function.Module._load (internal/modules/cjs/loader.js:901:14)"," at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)"," at internal/main/run_main_module.js:18:47"]}