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

Creating new entity with customFields, leads to migration failure #3274

Open
mschipperheyn opened this issue Dec 13, 2024 · 0 comments
Open
Labels
contributions welcome P4: low Non-critical, workarounds exist type: bug 🐛 Something isn't working @vendure/core

Comments

@mschipperheyn
Copy link
Collaborator

mschipperheyn commented Dec 13, 2024

Describe the bug
If you create a new entity that has customFields support, it will fail migration if you add the customFields right away in the plugin configuration. Kind of an edge case, since the entity doesn't exist yet before the migration.

Why use customFields in the first place on a custom entity? It seems like a flexible way to have a generic interface with good ui support for an entity that in my case is supposed to be very extensible in nature.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new entity with the HasCustomFields interface
  2. create a new migration
  3. Get a Cannot read properties of undefined (reading 'push')

Expected behavior
Ideally, this should be handled gracefully.

Environment (please complete the following information):

  • @vendure/core version: 3.0.8

Workaround
I thought the workaround would be to escape the customFields creation when you run the first migration creation command. Run pending migrations, then run the customFields migration as a second migration creation.

Unfortunately, it seems that Vendure doesn't include custom entities in their list of "customFields entities" during the start up process at the correct moment. So, the new entity doesn't get added to the config.customFields object before it hits the configation function. I haven't tested this yet against 3.1

@mschipperheyn mschipperheyn added the type: bug 🐛 Something isn't working label Dec 13, 2024
@michaelbromley michaelbromley moved this to 📦 Backlog in Vendure OS Roadmap Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome P4: low Non-critical, workarounds exist type: bug 🐛 Something isn't working @vendure/core
Projects
Status: 📦 Backlog
Development

No branches or pull requests

2 participants