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

v4.15.1 build error - not passing env object to plugin config file #18662

Closed
sjoukedv opened this issue Nov 3, 2023 · 6 comments
Closed

v4.15.1 build error - not passing env object to plugin config file #18662

sjoukedv opened this issue Nov 3, 2023 · 6 comments

Comments

@sjoukedv
Copy link
Contributor

sjoukedv commented Nov 3, 2023

Bug report

Required System information

  • Node.js version: v20.9.0 (LTS)
  • NPM version: yarn v4
  • Strapi version: 4.15.1
  • Database: n.a.
  • Operating system: Ubuntu 22.04 (not relevant also in node docker v20)
  • Is your project Javascript or Typescript: Typescript

Describe the bug

$ yarn install --immutable
$ yarn build
✔ Compiling TS (10524.976006999612ms)
⠋ Building build context
⠙ Building build context[INFO] Including the following ENV variables as part of the JS bundle:
    - ADMIN_PATH
    - STRAPI_ADMIN_BACKEND_URL
    - STRAPI_TELEMETRY_DISABLED
[ERROR]  There seems to be an unexpected error, try again with --debug for more information 

┌───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                                                                                                                       │
│   TypeError: Cannot destructure property 'env' of 'undefined' as it is undefined.                                                                     │
│       at plugins_default (<my-path>/config/plugins.ts:3:19)                                                      │
│       at loadUserPluginsFile (<my-path>/node_modules/@strapi/admin/dist/_chunks/index-86dfbe3a.js:759:49)        │
│       at async getEnabledPlugins (<my-path>/node_modules/@strapi/admin/dist/_chunks/index-86dfbe3a.js:736:27)    │
│       at async createBuildContext (<my-path>/node_modules/@strapi/admin/dist/_chunks/index-86dfbe3a.js:811:19)   │
│       at async Object.build (<my-path>/node_modules/@strapi/admin/dist/_chunks/index-86dfbe3a.js:901:15)         │
│       at async build (<my-path>/node_modules/@strapi/admin/dist/_chunks/build-f36bfc97.js:56:5)                  │
│       at async Command.parseAsync (<my-path>/node_modules/commander/lib/command.js:923:5)                        │
│       at async Module.runStrapiCommand (<my-path>/node_modules/@strapi/strapi/dist/commands/index.js:124:3)      │
│                                                                                                                                                       │
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

My plugin configuration file

export default ({ env }) => ({
...
// somewhere
//  env('MY_ENV_VARIABLE')
})

Steps to reproduce the behavior

See above

Expected behavior

Works fine for v4.15.0

$ yarn add @strapi/strapi@4.15.0
....
$ yarn build
Building your admin UI with development configuration...

✔ Webpack
  Compiled successfully in 38.23s

Did not find any breaking changes in the release notes so I expect this to keep working.

@sjoukedv
Copy link
Contributor Author

sjoukedv commented Nov 3, 2023

Related to the refactoring of the build pipeline? #18539

@broksonic21
Copy link

We are running into this as well. Definitely a new issue.

@joshuaellis
Copy link
Member

closed by #18657

@sjoukedv
Copy link
Contributor Author

sjoukedv commented Nov 3, 2023

@joshuaellis thanks! Is there also a simple strapi build in continuous integration? If not, can we add this also to avoid future issues like this? My project has nothing special but only uses ({env}) for the plugin parameters.

@broksonic21
Copy link

+1 to @sjoukedv comment re a strapi build as a CI test. That's what we do on our usage side as a confirmation (and what caused us to run into this breaking change, but that's a different issue: #18666 )

@alexandrebodin
Copy link
Member

alexandrebodin commented Nov 3, 2023

Thanks for the suggestion. We do build strapi multiple times in CI. But the plugins.js file doesn't exist by default as it's something you only add when using custom plugin configs :) We will definitely have to add a case with some custom plugin config 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants