-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix(ember): resolve config path from app root #3240
fix(ember): resolve config path from app root #3240
Conversation
I'm getting a related issue to this when having
Our app configuration is pretty conventional, so I'm wondering how this isn't broken for everyone... I'm going to look into other ways the path to the app's config file can be looked up so that it can be reliably found. |
Since |
@alexlafroscia testing it in my webapp, I've seen that using |
Oh that's interesting, I haven't tried that yet! Unfortunately none of this is very well documented on the Ember CLI side of things, if at all. I'll check that out in both the Ember app and addon that I've been trying to integrate this library into and see if that works reliably. I had poked around on |
This should aid in resolving the app configuration from the right location. Previously, it was calling `require` with a relative path from the `index.js` file of the Sentry addon itself. This broke trying to actually load the configuration file in _other_ apps or addons that might include this as a dependency. The Ember addon API exposes the configuration path for a given app or addon through the `project.configPath()` method, which we can use instead to look up the location of the project's `config/environment.js` file.
4fc7595
to
99e3af0
Compare
Great call-out @Gorzas, that API is definitely the way to go! I confirmed locally that it works both when I rebased this PR to simplify things and just use that. |
cc @k-fish |
@alexlafroscia hey sorry, I missed this PR but I have already put and merged a PR (#3246) that should hopefully fix this on both sides of Embroider and the classic build system, instead of trying to pull from app in a different hook, it sets it inside the config addon hook. Anyway, I only have the dummy test app to try it out with, if you'd like to pull sentry-javascript master and test out the change with your app to confirm, that would be great 👍 |
Or you can use |
That'll be much easier @kamilogorek ! I'll do that now |
Seems like the |
This should aid in resolving the app configuration from the right location. Previously, it was calling
require
with a relative path from theindex.js
file of the Sentry addon itself. This broke trying to actually load the configuration file in other addons that might include this as a dependency.By resolving the config path relative to the app root first, we can correctly load the file even when
@sentry/ember
is used within another addon.Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint
) & (yarn test
).