typeorm-aurora-data-api-driver: Notice of a potential bug
Hey,
I am fairly confident I have found a bug as I have seen this issue crop up now in two different scenarios. When running against my local mysql docker instance I have no issues but when running against Aurora Serverless MySql I have encountered the error:
"'param_1'' is an invalid type"
(well, param_X)
This is my log:
INFO query: SELECT `NewCompany`.`id` AS `NewCompany_id`, `NewCompany`.`name` AS `NewCompany_name`, `NewCompany`.`websiteUrl` AS `NewCompany_websiteUrl`, `NewCompany`.`numberOfEmployees` AS `NewCompany_numberOfEmployees`, `NewCompany`.`suggestedCategories` AS `NewCompany_suggestedCategories`, `NewCompany__existingCategories`.`updatedAt` AS `NewCompany__existingCategories_updatedAt`, `NewCompany__existingCategories`.`createdAt` AS `NewCompany__existingCategories_createdAt`, `NewCompany__existingCategories`.`version` AS `NewCompany__existingCategories_version`, `NewCompany__existingCategories`.`id` AS `NewCompany__existingCategories_id`, `NewCompany__existingCategories`.`name` AS `NewCompany__existingCategories_name`, `NewCompany__existingCategories`.`parentId` AS `NewCompany__existingCategories_parentId` FROM `new_company` `NewCompany` LEFT JOIN `new_company_existing_categories_company_category` `NewCompany_NewCompany__existingCategories` ON `NewCompany_NewCompany__existingCategories`.`newCompanyId`=`NewCompany`.`id` LEFT JOIN `company_category` `NewCompany__existingCategories` ON `NewCompany__existingCategories`.`id`=`NewCompany_NewCompany__existingCategories`.`companyCategoryId` WHERE (`NewCompany`.`id` IN (:param_0)) AND `NewCompany`.`id` IN (:param_1) -- PARAMETERS: [
{
"param_0": "ccca5f74-5dbd-485c-86a1-925622aeea61",
"param_1": [
"ccca5f74-5dbd-485c-86a1-925622aeea61"
]
}
I am going to have to try and find some time to reproduce an example for diagnosis. However the original time I saw this error it was rather obvious - there were two parameters which were being passed in the wrong way around. It’s worth noting that I am using this in conjunction with typeorm-transactional-cls-hooked
.
I understand this isn’t a very good issue report but I wanted to at least mention it in the event this is something you have come across yourself.
I am using this driver in production so I need to resolve this as soon as possible 😃
Versions:
"typeorm": "^0.2.19",
"typeorm-aurora-data-api-driver": "^1.1.4",
"typeorm-transactional-cls-hooked": "^0.1.8"
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 33 (15 by maintainers)
@ArsenyYankovsky after doing the update to latest typeorm (0.2.20) that param thing is ok now. With 0.2.19, or any smaller version there is that issue with params in the wrong order.
@TreeMan360 I’ve submitted the PR to TypeORM https://github.com/typeorm/typeorm/pull/4779. Unfortunately, we’ll have to wait for the PR to be merged and a new TypeORM version released for it to work. In the meantime you can try to use my fork of TypeORM to work.
@TreeMan360 the misplaced parameters issue is coming from typeorm itself. Since the AuroraDataApiDriver is not an instance of MysqlDriver a lot of the query fixes are not applied. Right now I’m trying to fix that and I will submit a PR when I’m ready. Your build is probably set to use my fork of typeorm so that’s why you might get these errors.
@TreeMan360 Got it reproduced, will see how I can fix that.
Ideal for me would be a branch with a failing test. I think the param error could be reproduced as a unit test. The update one sounds weird, could you try to reproduce it with a functional test please?