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

TypeError: classTransformer.plainToClass error when trying to find document from DB #288

Closed
rondered opened this issue Dec 1, 2021 · 2 comments

Comments

@rondered
Copy link

rondered commented Dec 1, 2021

Hello!
I'm running my server as Firebase cloud function using NestJS + Express.
When I try to get any kind of document from my DB - I get this error:

[0] >  [Nest] 37912  - 12/01/2021, 8:09:06 AM   ERROR [ExceptionsHandler] class_transformer_1.plainToClass is not a function
[0] >  TypeError: class_transformer_1.plainToClass is not a function
[0] >      at BaseFirestoreRepository.AbstractFirestoreRepository._this.extractTFromDocSnap (/Users/ron/private_git/powerdata/apps/api/node_modules/fireorm/lib/src/AbstractFirestoreRepository.js:149:46)
[0] >      at /Users/ron/private_git/powerdata/apps/api/node_modules/fireorm/lib/src/AbstractFirestoreRepository.js:155:101
[0] >      at Array.map (<anonymous>)
[0] >      at AbstractFirestoreRepository._this.extractTFromColSnap (/Users/ron/private_git/powerdata/apps/api/node_modules/fireorm/lib/src/AbstractFirestoreRepository.js:155:69)
[0] >      at processTicksAndRejections (internal/process/task_queues.js:95:5)

My Entity looks like that:

import { Collection, SubCollection, ISubCollection } from 'fireorm';

class Measurement {
  id: string;
  watt: number;
  phase: number;
  deviceId: string;
  timestamp: number;
}

@Collection('users')
export class User {
  id: string;
  houseId: string;

  @SubCollection(Measurement,'measurements')
  measurements?: ISubCollection<Measurement>;
}

Thanks and have a good day ^^ :)

@wovalle
Copy link
Owner

wovalle commented Dec 1, 2021

This was due a to a breaking change in class-transformer, should be fixed now.

@wovalle wovalle closed this as completed Dec 1, 2021
@rondered
Copy link
Author

rondered commented Dec 1, 2021

I have all my versions updated. It's a project from 1 day ago.

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