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

EntityHydrator does not shorten jointable alias names anymore #2899

Closed
MKmedicalvalues opened this issue Jun 14, 2024 · 0 comments · Fixed by #2959
Closed

EntityHydrator does not shorten jointable alias names anymore #2899

MKmedicalvalues opened this issue Jun 14, 2024 · 0 comments · Fixed by #2959
Labels
ORM Issues relating to potential bugs in the ORM type: bug 🐛 Something isn't working

Comments

@MKmedicalvalues
Copy link

MKmedicalvalues commented Jun 14, 2024

Describe the bug
While upgrading our vendure project to vendure v2.2, we ran into a typeorm QueryFailedError that suggested there were tablenames in our queries that were specified more than once.

After some debugging i tracked the issue down to the following:

This PR changed the EntityHydrator to use typeorms SelectQueryBuilder instead of the Repository to hydrate entities. The SelectQueryBuilder does not shorten alias names of joined relations, like the Repository does. When hydrating entities with very deeply nested relations (relation string resulting in a jointablename > 63 characters) now leads to alias names being cut off after 63 characters because of the alias string limitation of 63 characters in typeorms postgres driver. This leads to the errors we encountered in our project.

To Reproduce
Steps to reproduce the behavior:

  1. Try using the EntityHydrator with a very long relations string (> 63 characters) and you should run into said typeorm QueryFailedError.

Expected behavior
The EntityHydrator should be usable, regardless of the size of relation strings it is given, or at least, if the behavior is not changeable, check for length and throw an error indicating relation strings that are too long, which would obviously limit the buildable datamodels in vendure drastically, if you still want to use the EntityHydrator regarding performance.

Environment (please complete the following information):

  • @vendure/core version: v2.2.5
  • Nodejs version: v20.13.1
  • Database (mysql/postgres etc): postgres
@MKmedicalvalues MKmedicalvalues added the type: bug 🐛 Something isn't working label Jun 14, 2024
@michaelbromley michaelbromley moved this to 📋 Backlog in Vendure OS Roadmap Jun 14, 2024
@michaelbromley michaelbromley added the ORM Issues relating to potential bugs in the ORM label Jun 17, 2024
jnugh added a commit to jnugh/vendure that referenced this issue Jul 18, 2024
jnugh added a commit to jnugh/vendure that referenced this issue Jul 18, 2024
jnugh added a commit to jnugh/vendure that referenced this issue Aug 5, 2024
jayanti-prajapati pushed a commit to jayanti-prajapati/jpshop-server-admin that referenced this issue Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ORM Issues relating to potential bugs in the ORM type: bug 🐛 Something isn't working
Projects
Status: 🚀 Shipped
Development

Successfully merging a pull request may close this issue.

2 participants