Open srwilliamg opened 3 years ago
What's the query?
What's the parameters?
There's very, very little to go off of, here.
When opening an issue, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This boils down to ensuring your code that reproduces the problem follows the following guidelines:
The more code there is to go through, the less likely people can find your problem. Streamline your example in one of two ways:
Don't sacrifice clarity for brevity when creating a minimal example. Use consistent naming and indentation, and include code comments if needed. Use your code editor’s shortcut for formatting code.
Don't include any passwords or credentials that must be kept secret.
Make sure all information necessary to reproduce the problem is included in the issue itself.
If the problem requires some code as well as some XML-based configuration, include code for both. The problem might not be in the code that you think it is in.
Use individual code blocks for each file or snippet you include. Provide a description for the purpose of each block.
DO NOT use images of code. Copy the actual text from your code editor, paste it into the issus, then format it as code. This helps others more easily read and test your code.
To help you solve your problem, others will need to verify that it exists.
Describe the problem. "It doesn't work" isn't descriptive enough to help people understand your problem. Instead, tell other readers what the expected behavior should be. Tell other readers what the exact wording of the error message is, and which line of code is producing it. Use a brief but descriptive summary of your problem as the title of your question.
Eliminate any issues that aren't relevant to the problem. If your question isn’t about a compiler error, ensure that there are no compile-time errors.
Double-check that your example reproduces the problem! If you inadvertently fixed the problem while composing the example but didn't test it again, you'd want to know that before asking someone else to help.
What's the query?
What's the parameters?
There's very, very little to go off of, here.
Sorry i just finished to update the description
What's the definition of the entity Test
?
What's the definition of the entity
Test
?
@Entity('test', { schema: 'dbo' })
export class Test extends BaseEntity {
@PrimaryColumn({
type: 'int',
name: 'id',
nullable: false,
comment:
'This column represents the id of the entity. It composes the primary key of the table',
})
id: number;
@Column('nvarchar', {
name: 'test_name',
nullable: false,
length: 36,
})
name: string;
@Column('nvarchar', {
name: 'test_lastname',
nullable: false,
length: 36,
})
lastname: string;
}
I can't replicate - here's the test I created: https://gist.github.com/imnotjames/ae87930e4044a9f4d41d1f123bdba86b
Results:
github issues > #8070 Query with params throwing ERR_INVALID_ARG_TYPE
✓ should correctly attempt to find by ID
1 passing (366ms)
Can you create a test case that fails?
I can't replicate - here's the test I created: https://gist.github.com/imnotjames/ae87930e4044a9f4d41d1f123bdba86b
Results:
github issues > #8070 Query with params throwing ERR_INVALID_ARG_TYPE ✓ should correctly attempt to find by ID 1 passing (366ms)
Can you create a test case that fails?
I find the issue, the npm package mssql : "^7.2.0" I changed to mssql: "^6.3.2" and it works well
I have installed mssql 7.2.0 & re-ran the tests.
$ npm explain tedious
tedious@11.4.0 dev
node_modules/tedious
tedious@"^11.0.7" from mssql@7.2.0
node_modules/mssql
dev mssql@"^7.2.0" from the root project
I had to set trustServerCertificate
to true
.
However, the tests still passed.
@srwilliamg Were you able to resolve the issue, is it by downgrading the mssql to "^6.3.2".
Could you please provide the respective versions of the below modules if you have used:
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 directlyTest.createQueryBuilder('test').where('id = ${id}').getOne();
this works perfectlyExpected Behavior
return the query result
Actual Behavior
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
Additional Context
Relevant Database Driver(s)
aurora-data-api
aurora-data-api-pg
better-sqlite3
cockroachdb
cordova
expo
mongodb
mysql
nativescript
oracle
postgres
react-native
sap
sqlite
sqlite-abstract
sqljs
sqlserver
Are you willing to resolve this issue by submitting a Pull Request?