jclusso / strapi-plugin-netlify-deployments

Strapi v4 plugin to trigger and monitor a deployment on Netlify
https://jclusso.github.io/strapi-plugin-netlify-deployments/
MIT License
8 stars 11 forks source link

n00bish bro can't follow along: unspecified information, file paths, what kind of hook to create. #12

Open mpstaton opened 7 months ago

mpstaton commented 7 months ago

I've read this article like three times vigorously.

here is my ./config/plugins.js

UPDATE THE BELOW CODE WORKS if, go figure, you call accessToken: process.env.NETLIFY_DEPLOYMENTS_PLUGIN_ACCESS_TOKEN

I left that part out. However, it's not clear in your docs which parts of which code go in which files. In docs it's very helpful if you start at the top of your code snippets with a commented out file path.

module.exports = ({ env }) => ({
   "netlify-deployments": {
     enabled: true,
     config: {
       accessToken: NETLIFY_DEPLOYMENTS_PLUGIN_ACCESS_TOKEN
       ,
       sites: [
         {
           name: 'Eclectic-Content',
           id: "<netlify-plugin>",
           buildHook: "https://api.netlify.com/build_hooks/<hook_id>",
           branch: 'master' // optional
         }
       ]
     },
   },
 });

Notice in the above where the hook_id variable is. When I'm in Netlify, when I go to add hook, I have to specify the hook. I do not know how to specify a hook. This info should be in your docs.

here is my .env file

HOST=0.0.0.0
PORT=1337
APP_KEYS=<my-app-keys>
API_TOKEN_SALT=<my-token-salt>
ADMIN_JWT_SECRET=<my-jwt-secret>
TRANSFER_TOKEN_SALT=<my-transfer-salt>
NETLIFY_DEPLOYMENTS_PLUGIN_ACCESS_TOKEN=<"my-access-token">
# Database
DATABASE_CLIENT=sqlite
DATABASE_FILENAME=.tmp/data.db
JWT_SECRET=<my=

module.exports = ({ env }) => ({
  "netlify-deployments": {
    enabled: true,
    config: {
      accessToken: process.env.NETLIFY_DEPLOYMENTS_PLUGIN_ACCESS_TOKEN
    },
  },

Here is the error. I know I'm doing something wrong but if you want people trying to get a Strapi instance up and running, the docs should be clearer.

[ERROR] There seems to be an unexpected error, try again with --debug for more information

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ │ │ Error: Could not load js config file /Users/mps/code/lossless/eclectic__strapi-instance/config/plugins.js: NETLIFY_DEPLOYMENTS_PLUGIN_ACCESS_TOKEN is not defined │

mpstaton commented 7 months ago

This works now but only on local. If it's not deleted, just notice that the stupid omission of the process.env.

However, the plugin DOES NOT WORK to create a working instance of Strapi on Netlify. Something is missing.

I did find a tutorial, but the tutorial already has a working instance of Strapi somewhere.
https://www.netlify.com/blog/2020/06/24/use-a-custom-strapi-back-end-to-build-a-jamstack-app/ So, it doesn't help you setup Strapi, just call an API. The article does however talk about CORGS and CORGI and serverless functions. Is there some setting in Netlify that is preventing Strapi from having an accessible interface do to some CORGS protection? Can you add some serverless function documentation so that we can try it out?

I also found a netlify.toml file. This isn't covered in your docs either.
https://github.com/rustkas/netlify-strapi/blob/main/netlify.toml

Do you need a netlify.toml file?

Netlify is not showing any errors in the build or the deployment. It's only when I hit the admin page or any URL of the deploy that I get a 404 error.

image

What are the common things that go wrong if we follow your instructions exactly and the deployment doesn't work?

jclusso commented 7 months ago

I think you're confused about the purpose of this plugin.

This plugin is not for deploying Strapi to Netlify.

This plugin is for being able to trigger deploys of sites hosted on Netlify from within Strapi.