Skip to content

Query with params throwing ERR_INVALID_ARG_TYPE #8070

@srwilliamg

Description

@srwilliamg

Issue Description

When i run a query with params
example: Test.find({ where: { id } });
Im gettting the following error:
originalError: QueryFailedError: Error: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received type number (0)
code: ERR_INVALID_ARG_TYPE
When i try to use a QueryBuilder passing the argument directly
Test.createQueryBuilder('test').where('id = ${id}').getOne();
this works perfectly

Expected Behavior

return the query result

Actual Behavior

originalError: QueryFailedError: Error: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received type number (0)
code: ERR_INVALID_ARG_TYPE
`Test.find({ where: { id } });`

query failed: SELECT "test"."id" AS "test_id", "test"."test_name" AS "test_test_name", "test"."test_lastname" AS "test_test_lastname" FROM "dbo"."test" "test" WHERE id = @0 -- PARAMETERS: [1]

My Environment

Dependency Version
Operating System ubuntu
Node.js version v14.17.2
Typescript version typescript@4.0.5
TypeORM version typeorm@0.2.29

Additional Context

Relevant Database Driver(s)

DB Type Reproducible
aurora-data-api no
aurora-data-api-pg no
better-sqlite3 no
cockroachdb no
cordova no
expo no
mongodb no
mysql no
nativescript no
oracle no
postgres no
react-native no
sap no
sqlite no
sqlite-abstract no
sqljs no
sqlserver yes

Are you willing to resolve this issue by submitting a Pull Request?

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don't know how to start. I would need guidance.
  • ✖️ No, I don’t have the time, but I can support (using donations) development.
  • ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions