fix: environment variables not detected #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I came across this issue/error when running the
npm run seed
command.Initializing pluginsTypeError: Expected parameter accessToken at createCMAHttpClient (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/medusa-plugin-contentful/node_modules/contentful-management/dist/contentful-management.node.js:7479:11) at createClient (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/medusa-plugin-contentful/node_modules/contentful-management/dist/contentful-management.node.js:7424:99) at new ContentfulService (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/medusa-plugin-contentful/services/contentful.js:80:64) at /Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:377:112 at Object.resolve (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/awilix/lib/resolvers.js:295:20) at resolve (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/awilix/lib/container.js:250:41) at Object.get (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/awilix/lib/container.js:67:32) at new ContentfulSubscriber (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/medusa-plugin-contentful/subscribers/contentful.js:23:32) at /Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:405:77 at Object.resolve (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/awilix/lib/resolvers.js:295:20) at Object.build (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/awilix/lib/container.js:313:37) at /Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:405:19 at Array.forEach (<anonymous>) at registerSubscribers (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:403:11) at /Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:92:41 at step (/Users/mohammaddaffa/Documents/Projects/workshop/medusa/medusa-contentful/backend/node_modules/@medusajs/medusa/dist/loaders/plugins.js:33:23)
It looks like this was caused by the Environment Variables are not detected in the
medusa-config.js
file. To fix that, I added dotenv inside the file. Hope it is helpful. Thanks