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

Bundle extension loading but not working in 10.10.1 #21758

Closed
boncossoftware opened this issue Mar 8, 2024 · 12 comments · Fixed by #22013
Closed

Bundle extension loading but not working in 10.10.1 #21758

boncossoftware opened this issue Mar 8, 2024 · 12 comments · Fixed by #22013

Comments

@boncossoftware
Copy link

boncossoftware commented Mar 8, 2024

Describe the Bug

My custom bundle extension seems to be loading and visible in the Settings -> Extensions tab (see image).
Screenshot 2024-03-08 at 09 47 05

But they are not displayed in the collection item forms and are show up as "...not found" in the field interface settings (see image bellow).
Screenshot 2024-03-08 at 09 49 50

Also, the endpoints and hooks don't seem to be working.

I have made sure my bundle meets all of the latests requirements explained here https://docs.directus.io/releases/breaking-changes.html#deprecated-typed-extension-folders. The bundle is currently being imported as a npm package (not placed in the extensions folder).

Also one more thing to note is that when I check the "/extensions/sources/index.js" being loading from the app it seems to be completely empty (see image).

Screenshot 2024-03-08 at 09 58 29

To Reproduce

Wouldn't know exactly how to reproduce the issue with other extensions. I have a bundle type extension in typescript with many interfaces, endpoints, hooks and some displays and not sure if one of these is causing the issue. Might also be how the npm package is being build.

Directus Version

v10.10.1

Hosting Strategy

Self-Hosted (Custom)

@boncossoftware
Copy link
Author

Forgot to mention that the bundle extension was working in version 10.9.3.

@br41nslug
Copy link
Member

br41nslug commented Mar 8, 2024

How are you installing/deploying Directus and its extensions? Did you update the extensions-sdk for your extension when updating the Directus instance?

@boncossoftware
Copy link
Author

boncossoftware commented Mar 8, 2024

Yes, extensions-sdk version is currently at 11.0.1. I am deploying Directus in Google Cloud's App Engine and extension is added as a dependency in package.json. But haven't deployed this yet; the issue is occurring currently when I am running it locally on my machine.

@boncossoftware
Copy link
Author

Screenshot 2024-03-08 at 11 06 08

Screenshot 2024-03-08 at 11 07 04

I can also see that the built app.js exports the interfaces, etc.

@wolfgang-hartl
Copy link

wolfgang-hartl commented Mar 8, 2024

I am facing a similar Problem, with a slight difference. I've created a custom Hook inside of a bundle which works fine. But when adding an interface it doesn't show up. I've tried to add the interface with several ways:

  1. through npm run add
  2. manually
  3. npx create-directus-extension@latest

I have registered the extensions inside of the package.json which are located at: ./extensions/homart/....

Directus is running locally with a docker-compose.yml file!

Bildschirmfoto 2024-03-08 um 19 28 02

Directus Version 10.10.0 and 10.10.1 (both tested)
"@directus/extensions-sdk": "11.0.1",

When visiting the settings page only the hook shows up:
Bildschirmfoto 2024-03-08 um 19 30 44

@KayhanB
Copy link

KayhanB commented Mar 8, 2024

I experienced the same issue and found a workaround. When I deleted the records in the directus_extensions collection and restarted directus, the newly added extension started working. Make sure your bundle is packaged with the new extension before restarting. @wolfgang-hartl

@wolfgang-hartl
Copy link

I experienced the same issue and found a workaround. When I deleted the records in the directus_extensions collection and restarted directus, the newly added extension started working. Make sure your bundle is packaged with the new extension before restarting. @wolfgang-hartl

Thank you very much @KayhanB ... that works for me as well!! 👍

@boncossoftware
Copy link
Author

boncossoftware commented Mar 14, 2024

Alright, I seem to have found the issue. It looks like there is an bug in the migration script "20240204A-marketplace.js" where it only migrates the resolved npm package as a module (in this case a bundle) but is not resolving the extensions contained in the bundle as a module type (see image bellow) but instead leaving the source as a "local".

Screenshot 2024-03-14 at 10 43 42

This is the result in the database:
Screenshot 2024-03-14 at 10 23 17

They should all be module types because they all come from the same bundle extension.

This causes an issue when building the entry points in "generateExtensionsEntrypoint" (found in node.js in the @directus/extensions package) because it is looking for a module source extension and, when it fails to do so, defaults to enabled being false (see image below).

Screenshot 2024-03-14 at 10 48 07

@malipetek
Copy link

I experienced the same issue and found a workaround. When I deleted the records in the directus_extensions collection and restarted directus, the newly added extension started working. Make sure your bundle is packaged with the new extension before restarting. @wolfgang-hartl

Thanks, this was the case for my bundle extension as well. I guess this has something to do with starting with a faulty package.json

@aldoprogra
Copy link

I have hooks and endpoint working local but when deploying on railway they result to be enabled but they do no work. Should I build extensions when deploying? create a script that builds ? Thank you in advance

@wolfgang-hartl
Copy link

I have hooks and endpoint working local but when deploying on railway they result to be enabled but they do no work. Should I build extensions when deploying? create a script that builds ? Thank you in advance

Can only speak for myself, but deploying the extensions work fine for me. Make sure, that the dist folder is present when deploying your extensions. I guess it's also adviseable to change the version in the package.json in your extension if you modify an already deployed extension.

@aldoprogra
Copy link

I have hooks and endpoint working local but when deploying on railway they result to be enabled but they do no work. Should I build extensions when deploying? create a script that builds ? Thank you in advance

Can only speak for myself, but deploying the extensions work fine for me. Make sure, that the dist folder is present when deploying your extensions. I guess it's also adviseable to change the version in the package.json in your extension if you modify an already deployed extension.

Thank you very much! dist was in the .gitignore and removing it of course solved the problem. Thank you very much for the fast solution wolfgang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

8 participants