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

aurora-data-api-pg crashes with @PrimaryGeneratedColumn('uuid') #39

Closed
abd1tus opened this issue Jun 26, 2020 · 4 comments
Closed

aurora-data-api-pg crashes with @PrimaryGeneratedColumn('uuid') #39

abd1tus opened this issue Jun 26, 2020 · 4 comments

Comments

@abd1tus
Copy link

abd1tus commented Jun 26, 2020

When an entity has uuid as a primary column

either:

@Entity()
export class Organization {
  @PrimaryGeneratedColumn()
  @Generated('uuid')
  id!: string; 

or:

@Entity()
export class ExampleEntity {
  @PrimaryGeneratedColumn('uuid')
  id!: string; 
...

then the following:

const connection = await createConnection({
  type: 'aurora-data-api-pg', 
  entities: [ExampleEntity],
 ...
});

fails with:

2020-06-26T19:49:40.638Z	16e2936c-2dce-40bb-bdc6-0c01b2745e06	ERROR	Invoke Error 	{"errorType":"TypeError","errorMessage":"Cannot read property 'connect' of undefined","stack":["TypeError: Cannot read property 'connect' of undefined","    at /var/task/node_modules/typeorm/driver/postgres/PostgresDriver.js:285:42","    at new Promise (<anonymous>)","    at /var/task/node_modules/typeorm/driver/postgres/PostgresDriver.js:284:40","    at Array.map (<anonymous>)","    at AuroraDataApiPostgresDriver.<anonymous> (/var/task/node_modules/typeorm/driver/postgres/PostgresDriver.js:283:103)","    at step (/var/task/node_modules/tslib/tslib.js:141:27)","    at Object.next (/var/task/node_modules/tslib/tslib.js:122:57)","    at /var/task/node_modules/tslib/tslib.js:115:75","    at new Promise (<anonymous>)","    at Object.__awaiter (/var/task/node_modules/tslib/tslib.js:111:16)"]}

Removing the 'uuid' allows createConnection to succeed.

If I use:

const connection = await createConnection({
  type: 'postgres', 
  entities: [ExampleEntity],
 ...
});

with 'uuid' then createConnection also succeeds.

@abd1tus abd1tus changed the title aurora-data-api-pg crashes with uuid @PrimaryGeneratedColumn() aurora-data-api-pg crashes with @PrimaryGeneratedColumn('uuid') Jun 26, 2020
@ArsenyYankovsky
Copy link
Owner

Hey, sorry for a late response. I think the reason for this lies within TypeORM. I will check it and let you know what's going on.

@ArsenyYankovsky
Copy link
Owner

Found a reason for it, will hopefully be able to submit a PR to the TypeORM tomorrow.

@ArsenyYankovsky
Copy link
Owner

@abd1tus
The PR is submitted here typeorm/typeorm#6404

@ArsenyYankovsky
Copy link
Owner

The PR is merged, but you will need to wait for a new TypeORM release. Another option is to build the TypeORM yourself from a master branch.

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

2 participants