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

cant findOne by uuid #170

Open
orr-levinger-zets opened this issue Jul 4, 2024 · 0 comments
Open

cant findOne by uuid #170

orr-levinger-zets opened this issue Jul 4, 2024 · 0 comments

Comments

@orr-levinger-zets
Copy link

Package versions and database engine type (please complete the following information):

  • Database Engine: postgres
  • TypeORM Version:0.3.20
  • Driver Version 3.0.0

Describe the bug
console.log
query: CREATE EXTENSION IF NOT EXISTS "uuid-ossp"

  at Function.logInfo (node_modules/.pnpm/[email protected]_rfxwzxkxbwtl62eyw5cwgoizne/src/platform/PlatformTools.ts:235:17)

console.log
query: SELECT DISTINCT "distinctAlias"."IssueEntity_id" AS "ids_IssueEntity_id", "distinctAlias"."IssueEntity_createdAt" FROM (SELECT "IssueEntity"."id" AS "IssueEntity_id", "IssueEntity"."name" AS "IssueEntity_name", "IssueEntity"."description" AS "IssueEntity_description", "IssueEntity"."severity" AS "IssueEntity_severity", "IssueEntity"."createdBy" AS "IssueEntity_createdBy", "IssueEntity"."createdAt" AS "IssueEntity_createdAt", "IssueEntity"."updatedAt" AS "IssueEntity_updatedAt", "IssueEntity"."deletedAt" AS "IssueEntity_deletedAt", "IssueEntity"."mitigationId" AS "IssueEntity_mitigationId", "IssueEntity__IssueEntity_mitigation"."id" AS "IssueEntity__IssueEntity_mitigation_id", "IssueEntity__IssueEntity_mitigation"."createdAt" AS "IssueEntity__IssueEntity_mitigation_createdAt", "IssueEntity__IssueEntity_mitigation"."updatedAt" AS "IssueEntity__IssueEntity_mitigation_updatedAt", "IssueEntity__IssueEntity_mitigation"."deletedAt" AS "IssueEntity__IssueEntity_mitigation_deletedAt", "a5a0bbed906f55304b1afc460f7b718a4c150182"."id" AS "a5a0bbed906f55304b1afc460f7b718a4c150182_id", "a5a0bbed906f55304b1afc460f7b718a4c150182"."isPublic" AS "a5a0bbed906f55304b1afc460f7b718a4c150182_isPublic", "a5a0bbed906f55304b1afc460f7b718a4c150182"."mitigationId" AS "a5a0bbed906f55304b1afc460f7b718a4c150182_mitigationId", "a5a0bbed906f55304b1afc460f7b718a4c150182"."securityControlId" AS "a5a0bbed906f55304b1afc460f7b718a4c150182_securityControlId", "IssueEntity__IssueEntity_remediations"."id" AS "IssueEntity__IssueEntity_remediations_id", "IssueEntity__IssueEntity_remediations"."iacId" AS "IssueEntity__IssueEntity_remediations_iacId", "IssueEntity__IssueEntity_remediations"."codeTemplate" AS "IssueEntity__IssueEntity_remediations_codeTemplate", "IssueEntity__IssueEntity_remediations"."createdAt" AS "IssueEntity__IssueEntity_remediations_createdAt", "IssueEntity__IssueEntity_remediations"."updatedAt" AS "IssueEntity__IssueEntity_remediations_updatedAt", "IssueEntity__IssueEntity_remediations"."deletedAt" AS "IssueEntity__IssueEntity_remediations_deletedAt", "IssueEntity__IssueEntity_remediations"."issueId" AS "IssueEntity__IssueEntity_remediations_issueId", "52593920c25f963b7a25dbedc428cbb63d70fba8"."id" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_id", "52593920c25f963b7a25dbedc428cbb63d70fba8"."key" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_key", "52593920c25f963b7a25dbedc428cbb63d70fba8"."name" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_name", "52593920c25f963b7a25dbedc428cbb63d70fba8"."logo" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_logo", "52593920c25f963b7a25dbedc428cbb63d70fba8"."description" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_description", "52593920c25f963b7a25dbedc428cbb63d70fba8"."createdAt" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_createdAt", "52593920c25f963b7a25dbedc428cbb63d70fba8"."updatedAt" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_updatedAt", "52593920c25f963b7a25dbedc428cbb63d70fba8"."deletedAt" AS "52593920c25f963b7a25dbedc428cbb63d70fba8_deletedAt", "IssueEntity__mitigation"."id" AS "IssueEntity__mitigation_id", "IssueEntity__mitigation"."createdAt" AS "IssueEntity__mitigation_createdAt", "IssueEntity__mitigation"."updatedAt" AS "IssueEntity__mitigation_updatedAt", "IssueEntity__mitigation"."deletedAt" AS "IssueEntity__mitigation_deletedAt", "IssueEntity__mitigation__securityControlsAnnotations"."id" AS "IssueEntity__mitigation__securityControlsAnnotations_id", "IssueEntity__mitigation__securityControlsAnnotations"."isPublic" AS "IssueEntity__mitigation__securityControlsAnnotations_isPublic", "IssueEntity__mitigation__securityControlsAnnotations"."mitigationId" AS "99d957e65825e76d739760713eebfe00f595ae96", "IssueEntity__mitigation__securityControlsAnnotations"."securityControlId" AS "36e18dacec7b7e0df0c85f2df638c8d682a6bdf1", "a3106b5b7954195c9dc02a375be8950dd12315e6"."id" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_id", "a3106b5b7954195c9dc02a375be8950dd12315e6"."key" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_key", "a3106b5b7954195c9dc02a375be8950dd12315e6"."name" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_name", "a3106b5b7954195c9dc02a375be8950dd12315e6"."logo" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_logo", "a3106b5b7954195c9dc02a375be8950dd12315e6"."description" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_description", "a3106b5b7954195c9dc02a375be8950dd12315e6"."createdAt" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_createdAt", "a3106b5b7954195c9dc02a375be8950dd12315e6"."updatedAt" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_updatedAt", "a3106b5b7954195c9dc02a375be8950dd12315e6"."deletedAt" AS "a3106b5b7954195c9dc02a375be8950dd12315e6_deletedAt", "IssueEntity__remediations"."id" AS "IssueEntity__remediations_id", "IssueEntity__remediations"."iacId" AS "IssueEntity__remediations_iacId", "IssueEntity__remediations"."codeTemplate" AS "IssueEntity__remediations_codeTemplate", "IssueEntity__remediations"."createdAt" AS "IssueEntity__remediations_createdAt", "IssueEntity__remediations"."updatedAt" AS "IssueEntity__remediations_updatedAt", "IssueEntity__remediations"."deletedAt" AS "IssueEntity__remediations_deletedAt", "IssueEntity__remediations"."issueId" AS "IssueEntity__remediations_issueId" FROM "issues" "IssueEntity" LEFT JOIN "mitigations" "IssueEntity__IssueEntity_mitigation" ON "IssueEntity__IssueEntity_mitigation"."id"="IssueEntity"."mitigationId" AND ("IssueEntity__IssueEntity_mitigation"."deletedAt" IS NULL) LEFT JOIN "security_controls_annotations" "a5a0bbed906f55304b1afc460f7b718a4c150182" ON "a5a0bbed906f55304b1afc460f7b718a4c150182"."mitigationId"="IssueEntity__IssueEntity_mitigation"."id" LEFT JOIN "remediations" "IssueEntity__IssueEntity_remediations" ON "IssueEntity__IssueEntity_remediations"."issueId"="IssueEntity"."id" AND ("IssueEntity__IssueEntity_remediations"."deletedAt" IS NULL) LEFT JOIN "security_controls" "52593920c25f963b7a25dbedc428cbb63d70fba8" ON "52593920c25f963b7a25dbedc428cbb63d70fba8"."id"="a5a0bbed906f55304b1afc460f7b718a4c150182"."securityControlId" AND ("52593920c25f963b7a25dbedc428cbb63d70fba8"."deletedAt" IS NULL) LEFT JOIN "mitigations" "IssueEntity__mitigation" ON "IssueEntity__mitigation"."id"="IssueEntity"."mitigationId" AND ("IssueEntity__mitigation"."deletedAt" IS NULL) LEFT JOIN "security_controls_annotations" "IssueEntity__mitigation__securityControlsAnnotations" ON "IssueEntity__mitigation__securityControlsAnnotations"."mitigationId"="IssueEntity__mitigation"."id" LEFT JOIN "security_controls" "a3106b5b7954195c9dc02a375be8950dd12315e6" ON "a3106b5b7954195c9dc02a375be8950dd12315e6"."id"="IssueEntity__mitigation__securityControlsAnnotations"."securityControlId" AND ("a3106b5b7954195c9dc02a375be8950dd12315e6"."deletedAt" IS NULL) LEFT JOIN "remediations" "IssueEntity__remediations" ON "IssueEntity__remediations"."issueId"="IssueEntity"."id" AND ("IssueEntity__remediations"."deletedAt" IS NULL) WHERE ( (("IssueEntity"."id" = :param_1)) ) AND ( "IssueEntity"."deletedAt" IS NULL ) ORDER BY "IssueEntity"."createdAt" ASC) "distinctAlias" ORDER BY "distinctAlias"."IssueEntity_createdAt" ASC, "IssueEntity_id" ASC LIMIT 1 -- PARAMETERS: [{"name":"param_1","value":"000dc0d7-52c3-44c0-b7d2-3d7f5f5106f6"}]

  at Function.logInfo (node_modules/.pnpm/[email protected]_rfxwzxkxbwtl62eyw5cwgoizne/src/platform/PlatformTools.ts:235:17)

console.error
DatabaseErrorException: ERROR: operator does not exist: uuid = text; Hint: No operator matches the given name and argument types. You might need to add explicit type casts.; Position: 6936; SQLState: 42883
at de_DatabaseErrorExceptionRes (/Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@aws-sdk/client-rds-data/dist-es/protocols/Aws_restJson1.js:548:23)
at de_ExecuteStatementCommandError (/Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@aws-sdk/client-rds-data/dist-es/protocols/Aws_restJson1.js:399:25)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at /Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@smithy/middleware-serde/dist-es/deserializerMiddleware.js:4:24
at /Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@aws-sdk/middleware-signing/dist-es/awsAuthMiddleware.js:26:20
at /Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@smithy/middleware-retry/dist-es/retryMiddleware.js:27:46
at /Users/orrlevinger/work/services/apps/security-scanner/node_modules/.pnpm/[email protected]/node_modules/typeorm-aurora-data-api-driver/node_modules/@aws-sdk/middleware-logger/dist-es/loggerMiddleware.js:3:26 {
'$fault': 'client',
'$metadata': {
httpStatusCode: 400,
requestId: '195a45fe-e135-49c2-b809-32ce29161f09',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
}
}

To Reproduce

`import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
OneToOne,
JoinColumn,
OneToMany,
Index,
} from 'typeorm';

@entity('issues', { orderBy: { createdAt: 'ASC' } })
@Index(['name'], { unique: true })
export class IssueEntity {
@PrimaryGeneratedColumn('uuid')
id: string;

@column('text')
name: string;
}
`

`import { DataSource } from 'typeorm';
import { entities } from '@finding-manager/db/entities';

export const db = async () =>
new DataSource({
type: 'aurora-postgres',
database: 'finding-manager',
secretArn: process.env.RDS_SECRET_ARN,
resourceArn: process.env.RDS_CLUSTER_ARN,
region: process.env.AWS_REGION,
entities,
synchronize: false,
logging: true,
}).initialize();
`

import { db } from '@finding-manager/db/data-source'; import { issueService } from '@finding-manager/resources/issue/issue.service'; describe('create-findings', () => { beforeAll(async () => {}); afterAll(async () => {}); it('create-findings', async () => { const datasource = await db(); issueService.initialize(datasource); const res = await issueService.findOne('000dc0d7-52c3-44c0-b7d2-3d7f5f5106f6'); console.log('issue', res); }); });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant