algoliasearch-netlify icon indicating copy to clipboard operation
algoliasearch-netlify copied to clipboard

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

Open benjaminstary opened this issue 3 years ago • 6 comments

Hi, I try to run this plugin on my gitlab pipeline with netlify-cli, but this error is showing up. I've installed @algolia/[email protected] 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/[email protected] 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

benjaminstary avatar Apr 25 '22 09:04 benjaminstary

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.

benjaminstary avatar Apr 25 '22 13:04 benjaminstary

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

bodinsamuel avatar Apr 26 '22 08:04 bodinsamuel

Hi, I've updated my netlify.toml and removed @algolia/[email protected] 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/[email protected] 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    │
└─────────────────────────────┘

benjaminstary avatar Apr 26 '22 09:04 benjaminstary

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?

bodinsamuel avatar Apr 26 '22 09:04 bodinsamuel

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.😊

benjaminstary avatar Apr 26 '22 10:04 benjaminstary

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

sbellone avatar May 03 '22 08:05 sbellone