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

Service dependencies do not pass through properly in embedded engine (Ember 3.28) #835

Open
KeithKosh opened this issue Jan 31, 2023 · 3 comments

Comments

@KeithKosh
Copy link

I have been encountering this issue after upgrading our app from Ember 3.24.6 to 3.28.8.

Basically, if I try to access any defined service in a routeless engine that has been included by a routeable engine, an error is generated and the engine does not properly render its content. It can be easily seen by accessing the following repo I created in order to replicate the issue:

https://github.com/KeithKosh/ember-engines-services-embed-issue

  • Selecting the first link mounts the routeless engine by itself: the service is correctly accessible.
  • Selecting the second link accesses a routeable engine, which itself mounts the same routeless engine as above - but in this case the rendering errors out with the following error: Uncaught (in promise) Error: Assertion Failed: Attempting to inject an unknown injection: 'service:myService'.

This is happening with the 0.9.0 (latest) version of ember-engines. Both engines have the necessary service listed in the app's app.js and in their own engine.js.

Any advice would be appreciated. Is it possible there's an additional dependency missing somewhere or that this is not a recommended pattern? I've taken a good look at the docs but there doesn't appear to be any advice around this kind of scenario one way or the other.

Thanks!

@gtb104
Copy link

gtb104 commented Oct 31, 2023

We've just performed the same upgrade (3.24.0 - 3.28.12) and are experiencing the same issue. @KeithKosh, did you ever find a solution to this?

@KeithKosh
Copy link
Author

@gtb104 I moved the routeless engine service definitions (the engines = { ... { dependencies: { services: [ hash) out of the root application app.js and into the routeable engine's engine.js and that seemed to do the trick. 👍

@gtb104
Copy link

gtb104 commented Oct 31, 2023

Thanks for the tip. We'll try that out and see what happens.

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

2 participants