medusa
medusa copied to clipboard
Log error if config file fails to load
This improves the developer experience.
If you add throw new Error("You need to provide a JWT_SECRET")
inside medusa-config.js
, you would get the following error:
TypeError: Cannot read properties of undefined (reading 'plugins')
Which is somewhat confusing at first sight.
I'm using zod
to validate that required environment variables is set, and the errors are quite descriptive, so exposing them would be nice.
Maybe it would be better to not wrap the code in try catch block in the first place, since the catch block really doesn't do anything.
@olivermrbl This pull request seems Ok. I think it only needs to be merged.
I see this is not fixed somehow, my errors thrown inside medusa-config.js
now gets printed out 👌
I'll close this PR then