Closed jimafisk closed 2 years ago
The best approach for deploying to Netlify is to build your Plenti app in CI (e.g. GitHub Actions) outside of Netlify and then copy those assets over to Netlify to deploy the site. Here's an issue discussing exactly how to do that: https://github.com/plentico/plenti/issues/140
I also created a video explaining this process and why it's necessary: https://youtu.be/TmWIeUOsERY
There is also community written documentation that takes a slightly different approach by tracking your "public" build folder in git and then pointing Netlify to this location if you'd rather go with that approach: https://leighdinaya.com/post/deploy-plenti-site-on-netlify/
If your project doesn't require additional Netlify/Vercel features like protected pages, redirects, serverless functions, form backend, etc then your cheapest and easiest option would be to just use GitHub pages: https://plenti.co/docs/github-actions
Hi Jim, That all interesting....Hopefully Netlify will add the option to simply point to your Plenti docker image in the future. I have followed your post https://github.com/plentico/plenti/issues/140 and created a .github/workflows/netlify-deploy.yml
as you have suggested. Thanks for your recommendations here. I will try connecting the app to Netlify. :)
Hi jim, After going through the set up and deploying to Netlify I get an error. See below. Failed at the netlify-cli@8.6.0 postinstall script.
any ideas? There is more info in the Netlify log:
I just took a look at your last failed build and it looks like an error I was seeing locally when I first cloned your project:
Error: Unable to read site config file unexpected end of JSON input.
Are you in the site folder that was created?.
We suggest that you begin by typing:
cd [project name]
plenti serve
To fix this on my end I simply ran plenti theme add https://github.com/plenti-themes/compendium
and that made some adjustments to plenti.json
that fixed this. If you try that locally and then commit the changes and push them up does that fix things?
Hi jim,
No unfortunately. I just ran that command and did see a change to the plenti.json
file. See my commit below.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
modified: .DS_Store
modified: plenti.json
deleted: themes/compendium/.DS_Store
deleted: themes/compendium/.github/.DS_Store
modified: themes/compendium/assets/color-scheme.css
I'm still getting the same error.
Do I need to run plenti build
before pushing to the repo? I was thinking that i don't need to because that folder is ignored.
Looking at the latest failed build it does appear that fixed the issue I mentioned above, but now it's failing at the "Deploy to Netlify" step like you first mentioned:
Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only file and data URLs are supported by the default ESM loader
According to this you probably have to update your version of NodeJS used in CI. The script I referenced in https://github.com/plentico/plenti/issues/140 is quite old and uses v13 so maybe try changing the line node-version: '13'
to node-version: '16'
in your .github/workflows/netlify-deploy.yml
file and see if that works?
Actually that worked....I changed the node version to 16 and the build looked like it failed again but i got the green tick! :) thanks for all this.https://vigorous-einstein-b90548.netlify.app
Nice! I'm glad it's working :tada:
Yes ...but it's very strange because it does initially fail then a few seconds later it builds successfully...but the error only shows up on the Netlify end...not in Github actions.
That's because it's still trying to do the build on Netlify and with GitHub Actions. The netlify build doesn't work so you can remove that entirely under Site Settings > Build & Deploy > Edit Settings
. Just delete the "Build command" and "Publish directory" then set the "Builds" to "Stop builds":
Great! thanks Jim. This worked 👍