Uh oh!
There was an error while loading. Please reload this page.
fix(ember): resolve config path from app root - #3240
Conversation
alexlafroscia
commented
Feb 8, 2021
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 |
alexlafroscia
commented
Feb 9, 2021
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
99e3af0Comparealexlafroscia
commented
Feb 9, 2021
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. |
kamilogorek
commented
Feb 17, 2021
cc @k-fish |
k-fish
commented
Feb 17, 2021
@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 👍 |
kamilogorek
commented
Feb 18, 2021
Or you can use |
alexlafroscia
commented
Feb 18, 2021
That'll be much easier @kamilogorek ! I'll do that now |
alexlafroscia
commented
Feb 18, 2021
Seems like the |
This should aid in resolving the app configuration from the right location. Previously, it was calling
requirewith a relative path from theindex.jsfile 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/emberis used within another addon.Before submitting a pull request, please take a look at our
Contributing guidelines and verify:
yarn lint) & (yarn test).