TypeError: class_transformer_1.classToPlain is not a function - using 1.15.0-beta.10
See original GitHub issueI’m not sure if this is an issue with 1.15.0-beta.10. I’ve upgraded my ORM app and added/modified the following in my package.json file:
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.131.0",
"@aws-sdk/lib-dynamodb": "^3.131.0",
"@typedorm/common": "1.15.0-beta.10",
"@typedorm/core": "1.15.0-beta.10",
"aws-crt": "^1.13.1",
...
I haven’t changed any other files (I’m not sure if i needed to?)
Everything builds fine, but at run time I get the following stack errors.
"stacktrace": [
"TypeError: class_transformer_1.classToPlain is not a function",
" at DocumentClientRequestTransformer.applyClassTransformerFormations (/path-to-my-app/packages/core/src/classes/transformer/base-transformer.ts:52:36)",
" at DocumentClientRequestTransformer.toDynamoEntity (/path-to-my-app/packages/core/src/classes/transformer/base-transformer.ts:94:31)",
" at DocumentClientRequestTransformer.toDynamoPutItem (/path-to-my-app/packages/core/src/classes/transformer/document-client-request-transformer.ts:136:31)",
" at EntityManager.<anonymous> (/path-to-my-app/packages/core/src/classes/manager/entity-manager.ts:198:55)",
" at Generator.next (<anonymous>)",
" at /path-to-my-app/lib/orm/node_modules/@typedorm/core/cjs/src/classes/manager/entity-manager.js:8:71",
" at new Promise (<anonymous>)",
" at __awaiter (/path-to-my-app/lib/orm/node_modules/@typedorm/core/cjs/src/classes/manager/entity-manager.js:4:12)",
" at EntityManager.create (/path-to-my-app/lib/orm/node_modules/@typedorm/core/cjs/src/classes/manager/entity-manager.js:35:16)",
" at /path-to-my-app/myapp/src/resolvers/mutation/createProduct.ts:17:70"
]
What’s kind of odd is the reference to the following file path that doesn’t exist:
/packages/core/src/classes/transformer/base-transformer.ts
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
classToPlain is not a function · Issue #8637 · nestjs/nest - GitHub
Steps to reproduce. Copy the Serializer example from Nestjs; Run the application; Make a request to a controller, see error. Expected behavior.
Read more >using validation pipe in nestjs gives me an classTransformer ...
problem solved. due to recent update, class-transformer@0.5.0 makes an error when used in validationPipe of nestJS.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@whimzyLive No problem. You can find it here.
https://github.com/danieljarrett74/typedorm-test
Thanks @whimzyLive thats a great help. I currently use webpack to build the project which uses the module/package the the typedorm code is in. But I thought it might be easier to build this local module with rollup. And if it wasn’t for the following it would be ok 😃
I tried following your example on your forked repo and it built fine but when I included the built module in my project I got the error:
ES modules is not supported
So then I tried to build it as a cjs with the following config (below) and everything worked fine, but at runtime the
AUTO_GENERATE_ATTRIBUTE_STRATEGY.ISO_DATE
isn’t working. As in when I do an insert the created and updated date for the following code don’t get created:rollup.config.js
tsconfig.json
package.json