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
Building and running extensions is broken #11275
Comments
Same issue here, is there any way around it? |
You can downgrade to "@directus/extensions-sdk": "9.4.0" until it's fixed |
Using
I have created a fresh new endpoint using the reproduction steps. I even ran |
I can also reproduce the same error. Downgrading @directus/extensions-sdk to 9.4.0 does help, though. |
Doesn't help for me, still warnings of circular dependency |
@ybelenko I'm using Before: Also make sure to do the same for the "host" property above (just in case): "directus:extension": {
"type": "endpoint",
"path": "dist/index.js",
"source": "src/index.ts",
"host": "9.4.3"
} |
Those "Circular dependency" messages are just warnings that shouldn't affect the extension in any way (though we should probably silence them to reduce confusion). |
Build process with 9.4.3(even console states that): node_modules/.bin/directus-extension -v && node_modules/.bin/directus-extension build
9.4.3
⠹ Building Directus extension...Circular dependency: node_modules/joi/lib/index.js -> node_modules/joi/lib/cache.js -> node_modules/joi/lib/common.js -> node_modules/joi/lib/schemas.js -> node_modules/joi/lib/index.js
Circular dependency: node_modules/joi/lib/index.js -> node_modules/joi/lib/cache.js -> node_modules/joi/lib/common.js -> node_modules/joi/lib/schemas.js -> /Users/ybelenko/Sites/bdo-feedback/node_modules/joi/lib/index.js?commonjs-proxy -> node_modules/joi/lib/index.js
Circular dependency: node_modules/joi/lib/common.js -> node_modules/joi/lib/messages.js -> node_modules/joi/lib/template.js -> node_modules/joi/lib/common.js
Circular dependency: node_modules/joi/lib/common.js -> node_modules/joi/lib/messages.js -> node_modules/joi/lib/template.js -> /Users/ybelenko/Sites/bdo-feedback/node_modules/joi/lib/common.js?commonjs-proxy -> node_modules/joi/lib/common.js
Circular dependency: node_modules/joi/lib/common.js -> node_modules/joi/lib/messages.js -> node_modules/joi/lib/template.js -> node_modules/joi/lib/errors.js -> node_modules/joi/lib/annotate.js -> node_modules/joi/lib/common.js
Circular dependency: node_modules/joi/lib/common.js -> node_modules/joi/lib/messages.js -> node_modules/joi/lib/template.js -> node_modules/joi/lib/errors.js -> node_modules/joi/lib/common.js
Circular dependency: node_modules/joi/lib/template.js -> node_modules/joi/lib/errors.js -> node_modules/joi/lib/template.js
Circular dependency: node_modules/joi/lib/template.js -> node_modules/joi/lib/errors.js -> /Users/ybelenko/Sites/bdo-feedback/node_modules/joi/lib/template.js?commonjs-proxy -> node_modules/joi/lib/template.js
Circular dependency: node_modules/joi/lib/common.js -> node_modules/joi/lib/messages.js -> node_modules/joi/lib/template.js -> node_modules/joi/lib/ref.js -> node_modules/joi/lib/common.js
Circular dependency: node_modules/joi/lib/template.js -> node_modules/joi/lib/ref.js -> node_modules/joi/lib/template.js
✔ Done package.json: {
"name": "directus-extension-bdo-feedback",
"version": "1.0.0",
"keywords": [
"directus",
"directus-extension",
"directus-custom-hook"
],
"directus:extension": {
"type": "hook",
"path": "dist/index.js",
"source": "src/index.js",
"host": "9.4.3"
},
"scripts": {
"build": "directus-extension build"
},
"devDependencies": {
"@directus/extensions-sdk": "9.4.3"
},
"dependencies": {
"joi": "^17.4.2",
"libphonenumber-js": "^1.9.47"
}
} Directus startup: npm run dev -- --scope directus --scope @directus/app
> dev
> lerna run dev --stream --parallel "--scope" "directus" "--scope" "@directus/app"
lerna notice cli v4.0.0
lerna notice filter including ["directus","@directus/app"]
lerna info filter [ 'directus', '@directus/app' ]
lerna info Executing command in 2 packages: "npm run dev"
@directus/app: > @directus/app@9.5.1 dev
@directus/app: > vite
directus: > directus@9.5.1 dev
directus: > cross-env NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch ".env" --inspect=0 --exit-child -- src/start.ts
directus: [INFO] 20:40:33 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.5.2)
directus: Debugger listening on ws://127.0.0.1:49845/40ccd0d9-da49-4db4-9cd2-264d2db476a6
directus: For help, see: https://nodejs.org/en/docs/inspector
@directus/app: vite v2.6.14 dev server running at:
@directus/app: > Local: http://localhost:8080/admin/
@directus/app: > Network: use `--host` to expose
@directus/app: ready in 2007ms.
directus: 20:40:51 ⚠️ Couldn't register hook "bdo-feedback"
directus: 20:40:51 ⚠️ Cannot read properties of undefined (reading 'string')
directus: 20:40:51 ✨ Loaded extensions: bdo-feedback
directus: 20:40:51 ✨ Server started at http://localhost:8055 @HitomiTenshi Do you import
then extension hook conpletely skipped by the app. |
@nickrum I checked and the extension loads properly and works even with the warnings. Okay false alarm, it's fixed! Thanks! Although it would be nice if the warnings are hidden 👍 @ybelenko I'm not importing |
Well, now I'm confident that it's because I use import Joi from 'joi';
export default ({ filter }, { services, exceptions }) => {
}; gives: directus: 23:16:25 ⚠️ Couldn't register hook "bdo-feedback"
directus: 23:16:25 ⚠️ Cannot read properties of undefined (reading 'string') // import Joi from 'joi';
export default ({ filter }, { services, exceptions }) => {
}; correct output: directus: 23:17:04 ✨ Loaded extensions: bdo-feedback |
Instead of import try require it works.. not sure what is the issue here |
No warnings about circular dependencies now, but it doesn't actually pack deps into extension build. directus: 13:34:35 ⚠️ Couldn't register hook "bdo-feedback"
directus: 13:34:35 ⚠️ Cannot find module 'libphonenumber-js' Of course I can create a fork of Directus and add missed packages to |
UPD: as temp workaround I use commonJs( npm i --save joi so {
"name": "my-project",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "directus start"
},
"dependencies": {
--- "directus": "^9.5.2"
+++ "directus": "^9.5.2",
+++ "joi": "^17.6.0"
}
}
|
Preflight Checklist
Describe the Bug
Extensions do not work anymore since
@directus/extensions-sdk 9.5.0
.To Reproduce
endpoint
my-extension
typescript
my-extension
Errors Shown
When trying to load the resulting
index.js
in directus, this is what gets logged:What version of Directus are you using?
9.5.0
What version of Node.js are you using?
16.13.2
What database are you using?
MariaDB 10.3.32
What browser are you using?
N/A
What operating system are you using?
Windows 10
How are you deploying Directus?
Ubuntu Server 20.04, npm installation with a systemd service running it
The text was updated successfully, but these errors were encountered: