Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: This plugin does not work locally, please deploy to a branch to test it. #811

Open
benistary opened this issue Apr 25, 2022 · 6 comments

Comments

@benistary
Copy link

benistary commented Apr 25, 2022

Hi, I try to run this plugin on my gitlab pipeline with netlify-cli, but this error is showing up. I've installed @algolia/netlify-plugin-crawler@1.0.12 into my devDependencies because of problems with 1.0.14 related to this #712

$ sdk_run netlify deploy --build --prod
## /usr/bin/buildah run -t --add-history sdk-249368 -- netlify deploy --build --prod
(node:1) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
​
┌─────────────────────────────┐
│        Netlify Build        │
└─────────────────────────────┘
​
❯ Version
  @netlify/build 4.1.3
​
❯ Flags
  mode: cli
​
❯ Current directory
  /data/builds/dovera/mojezdravie/design-system/.release
​
❯ Config file
  /data/builds/dovera/mojezdravie/design-system/.release/netlify.toml
​
❯ Context
  production
​
❯ Loading plugins
   - @algolia/netlify-plugin-crawler@1.0.12 from netlify.toml and package.json
​
┌───────────────────────────────────────────────────────────┐
│ 1. onSuccess command from @algolia/netlify-plugin-crawler │
└───────────────────────────────────────────────────────────┘
​
Algolia Netlify plugin started
​
┌─────────────────────────────────────────────────┐
│ Plugin "@algolia/netlify-plugin-crawler" failed │
└─────────────────────────────────────────────────┘
​
  Error message
  Error: This plugin does not work locally, please deploy to a branch to test it.
​
  Plugin details
  Package:        @algolia/netlify-plugin-crawler
  Version:        1.0.12
  Repository:     git+https://github.com/algolia/algoliasearch-netlify.git
  npm link:       https://www.npmjs.com/package/@algolia/netlify-plugin-crawler
  Report issues:  https://github.com/algolia/algoliasearch-netlify/issues
​
  Error location
  In "onSuccess" event in "@algolia/netlify-plugin-crawler" from netlify.toml and package.json
      at onSuccess (/node_modules/@algolia/netlify-plugin-crawler/dist/index.js:55:28)
​
  Resolved config
  plugins:
    - inputs:
        renderJavaScript: true
      origin: config
      package: '@algolia/netlify-plugin-crawler'
​
┌─────────────────────────────┐
│   Netlify Build Complete    │
└─────────────────────────────┘
​
(Netlify Build completed in 460ms)
Please provide a publish directory (e.g. "public" or "dist" or "."):

netlify.toml

[[plugins]]
package = "@algolia/netlify-plugin-crawler"
  [plugins.inputs]
  branches = ['master']
  renderJavaScript = true
@benistary
Copy link
Author

benistary commented Apr 25, 2022

Error: This plugin does not work locally, please deploy to a branch to test it.

What I understand from this error message is, that plugin does not work locally, so if I try to install older version of it into my devDependencies it gives me this error, but when I remove it from devDependencies and let it automatically use newest version (1.0.14) it gives me another error - #712

So what should I do in my case please? Because downgrading doesn't work.

@bodinsamuel
Copy link
Contributor

Hello,
We have released the 1.0.15, can you try and see if it fixes your issue?

@benistary
Copy link
Author

benistary commented Apr 26, 2022

Hi, I've updated my netlify.toml and removed @algolia/netlify-plugin-crawler@1.0.12 from my devDependencies. Same error as in 1.0.12 version above.

[[plugins]]
package = "@algolia/netlify-plugin-crawler"

We run netlify build with these commands (ci.yaml). We push only buildes files to netlify:

  - sdk_run netlify deploy -d netlify --build --prod --debug
  - sdk_run netlify deploy -d netlify --alias $CI_COMMIT_REF_SLUG

Log

$ sdk_run netlify deploy -d netlify --build --prod --debug
## /usr/bin/buildah run -t --add-history sdk-249722 -- netlify deploy -d netlify --build --prod --debug
​
❯ Initial build environment
cwd: /data/builds/dovera/mojezdravie/design-system/.release
mode: cli
siteId: 3916ba4e-371b-4c26-a778-0d653f8d4f18
(node:1) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use `node --trace-warnings ...` to show where the warning was created)
​
❯ UI build settings
baseRelDir: true
​
❯ Resolved build environment
branch: master
buildDir: /data/builds/dovera/mojezdravie/design-system/.release
configPath: /data/builds/dovera/mojezdravie/design-system/.release/netlify.toml
context: production
​
❯ Resolved config
plugins:
  - inputs: {}
    origin: config
    package: '@algolia/netlify-plugin-crawler'
​
┌─────────────────────────────┐
│        Netlify Build        │
└─────────────────────────────┘
​
❯ Version
  @netlify/build 4.1.3
​
❯ Flags
  debug: true
  featureFlags: {}
  mode: cli
​
❯ Current directory
  /data/builds/dovera/mojezdravie/design-system/.release
​
❯ Config file
  /data/builds/dovera/mojezdravie/design-system/.release/netlify.toml
​
❯ Resolved config
  plugins:
    - inputs: {}
      origin: config
      package: '@algolia/netlify-plugin-crawler'
​
❯ Context
  production
​
❯ Installing plugins
   - @algolia/netlify-plugin-crawler
​
❯ Loading plugins
   - @algolia/netlify-plugin-crawler@1.0.15 from netlify.toml
​
┌───────────────────────────────────────────────────────────┐
│ 1. onSuccess command from @algolia/netlify-plugin-crawler │
└───────────────────────────────────────────────────────────┘
​
Algolia Netlify plugin started
​
┌─────────────────────────────────────────────────┐
│ Plugin "@algolia/netlify-plugin-crawler" failed │
└─────────────────────────────────────────────────┘
​
  Error message
  Error: This plugin does not work locally, please deploy to a branch to test it.
​
  Plugin details
  Package:        @algolia/netlify-plugin-crawler
  Version:        1.0.15
  Repository:     git+https://github.com/algolia/algoliasearch-netlify.git
  npm link:       https://www.npmjs.com/package/@algolia/netlify-plugin-crawler
  Report issues:  https://github.com/algolia/algoliasearch-netlify/issues
​
  Error location
  In "onSuccess" event in "@algolia/netlify-plugin-crawler" from netlify.toml
      at onSuccess (/data/builds/dovera/mojezdravie/design-system/.release/.netlify/plugins/node_modules/@algolia/netlify-plugin-crawler/dist/index.js:55:28)
      at Object.run (/usr/local/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/plugins/child/run.js:16:9)
      at handleEvent (/usr/local/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/plugins/child/main.js:34:61)
      at /usr/local/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/plugins/child/main.js:28:61
      at process.<anonymous> (/usr/local/lib/node_modules/netlify-cli/node_modules/@netlify/build/src/plugins/ipc.js:102:15)
      at process.emit (events.js:314:20)
      at emit (internal/child_process.js:902:12)
      at processTicksAndRejections (internal/process/task_queues.js:81:21)
​
  Resolved config
  plugins:
    - inputs: {}
      origin: config
      package: '@algolia/netlify-plugin-crawler'
​
┌─────────────────────────────┐
│   Netlify Build Complete    │
└─────────────────────────────┘

@bodinsamuel
Copy link
Contributor

bodinsamuel commented Apr 26, 2022

ah well as it says it can not work locally, we detect local mode with Netlify constants
constants.IS_LOCAL if this boolean is true and you are running this command in Netlify then there is an issue in there code.

Can you provide some assistance @ehmicky ? ☺️

Edit: I missed that you are running this on your gitlab. So indeed it won't work, unless onSuccess now triggers correctly with cli?

@benistary
Copy link
Author

benistary commented Apr 26, 2022

Yes it's private gitlab on our servers. So is there any option for me please, how can I make the crawler works? Because I did not find anything in Algolia docs about netlify-cli / crawler use case.😊

@sbellone
Copy link
Collaborator

sbellone commented May 3, 2022

Indeed netlify-cli is not officially supported, we'd need to study that.
For now, you can maybe try to edit the code yourself to remove the check: https://github.com/algolia/algoliasearch-netlify/blob/master/plugin/src/index.ts#L74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants