Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
TypeORM join maps to table.relation.id instead of table.relationId

I have somehow encountered a weird error, am joining alot of tables, a subset of the code as below:

...

.leftJoinAndSelect('req.steps', 'step')
.leftJoinAndSelect('step.user', 'appUser')
.leftJoinAndSelect('appUser.user', 'appStaff')

...

and the error I get is:

Unknown column 'appuser.user.id' in 'on clause'

and the table clearly has a userId column, so the strange part is all the other columns are trasnlated correctly, a subset of the generated query as below:

LEFT JOIN `step` `step` ON `step`.`requestId`=`req`.`id`  LEFT JOIN `step_user` `appUser` ON `appUser`.`id`=`step`.`userId`  LEFT JOIN `user` `appStaff` ON `appStaff`.`id`=appUser.user.id AND (`appStaff`.`deleted` IS NULL)

And a subsection of the entity:

  @ManyToOne(() => User, user => user.steps)
  user: User;

Basically, they are all defined the same but end up with different output, can someone explain to me what i did wrong here or if this is a known issue.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!