dimitrov-adrian / directus-extension-searchsync

Simple Directus 9 extension that sync content with remote search engine.
MIT License
116 stars 27 forks source link

Cannot find a way to start it #26

Open quentinglorieux opened 1 year ago

quentinglorieux commented 1 year ago

I get this error: unknown command 'extension:searchsync' What am I missing ?

keniobats commented 1 year ago

I'm having the same issue. Do you have any updates on this?. Thanks

keniobats commented 1 year ago

Hi @quentinglorieux

I've just did it (by chance). You just have to position inside the extensions/directus-extension-searchsync/ directory and run the "npx directus". This will load the plugin.

/directus/extensions $ npx directus
Usage: directus [command] [options]

Options:
  -v, --version        output the version number
  -h, --help           display help for command

Commands:
  start                Start the Directus API
  init                 Create a new Directus Project
  security
  database
  users
  roles
  count <collection>   Count the amount of items in a given collection
  bootstrap [options]  Initialize or update the database
  schema
  help [command]       display help for command
[14:44:53.559] WARN: Couldn't load extensions
[14:44:53.559] WARN: Current folder does not contain a package.json file
    err: {
      "type": "Error",
      "message": "Current folder does not contain a package.json file",
      "stack":
          Error: Current folder does not contain a package.json file
              at getPackageExtensions (/directus/node_modules/@directus/shared/dist/cjs/utils/node/get-extensions.js:84:15)
              at async ExtensionManager.getExtensions (/directus/node_modules/directus/dist/extensions.js:249:35)
              at async ExtensionManager.load (/directus/node_modules/directus/dist/extensions.js:183:31)
              at async ExtensionManager.initialize (/directus/node_modules/directus/dist/extensions.js:97:13)
              at async createCli (/directus/node_modules/directus/dist/cli/index.js:27:5)
    }
/directus/extensions $ cd directus-extension-searchsync/
/directus/extensions/directus-extension-searchsync $ ls
LICENSE            README.md          index.js           jsconfig.json      lib                node_modules       package-lock.json  package.json       types.ts
/directus/extensions/directus-extension-searchsync $ npx directus
Usage: directus [command] [options]

Options:
  -v, --version         output the version number
  -h, --help            display help for command

Commands:
  extension:searchsync
  start                 Start the Directus API
  init                  Create a new Directus Project
  security
  database
  users
  roles
  count <collection>    Count the amount of items in a given collection
  bootstrap [options]   Initialize or update the database
  schema
  help [command]        display help for command
[14:45:36.665] INFO: Loaded extensions: directus-extension-searchsync

But now I'm facing an indexing issue wich I don't know how to solve really:

/directus/extensions/directus-extension-searchsync $ npx directus extension:searchsync index [14:56:28.589] INFO: Loaded extensions: directus-extension-searchsync [14:56:28.807] WARN: Cannot drop collection "prueba". Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.830] WARN: Cannot index "prueba/3". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.835] WARN: Cannot index "prueba/4". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.841] WARN: Cannot index "prueba/5". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.848] WARN: Cannot index "prueba/6". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.853] WARN: Cannot index "prueba/7". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.858] WARN: Cannot index "prueba/8". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.864] WARN: Cannot index "prueba/9". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.870] WARN: Cannot index "prueba/10". Error: Request failed with status code 400 extension: "directus-extension-searchsync" [14:56:28.876] WARN: Cannot index "prueba/2". Error: Request failed with status code 400 extension: "directus-extension-searchsync"

LeBenLeBen commented 1 year ago

What is your setup? Are you using Docker?

keniobats commented 1 year ago

@LeBenLeBen Yes, I'm using docker engine v20, directus v9.23.1 and ELK Stack v 8.4.2

LeBenLeBen commented 1 year ago

Installing extensions from npm in the defaut Directus setup doesn’t work very well since the container doesn’t use the package.json. I personally created a custom container that load and install a local package.json where I installed the extension.

You can check my setup here: