https://serverless-stack.com/ logo
#help
Title
# help
m

Manoel Feliciano

01/31/2022, 10:17 PM
Hi guys, I am using SST together with typeorm, but typeorm is unable to find the entities if I define the path for the files. This works normally under jest tests environment though. I took a look at .build folder and saw that only the routes entrypoints are included. Has anyone had this problem before? Any guidance?
The error that I am getting is: “No repository for UserTypeOrm was found. Looks like this entity is not registered in current dev connection?”
p

p0wl

01/31/2022, 10:54 PM
SST Function (and the cdk NodejsFunction that it is build upon) is using esbuild to bundle the lambda code. It does not copy not statically required files to the build output, but you probably can use copyFiles to copy the files you need to the build output.
m

Matt Morgan

01/31/2022, 11:00 PM
I haven't used typeorm with SST, but I do have some experience using typeorm and actually importing the classes instead of pointing to a path. But I've also not gotten esbuild to work with emitDecoratorMetadata. Did you use a plugin for that?
m

Manoel Feliciano

02/01/2022, 11:36 AM
Hi @Matt Morgan, I managed to make it work by importing the classes as you said. Thanks for that!
m

Matt Morgan

02/01/2022, 11:37 AM
Cool, glad it worked! Are you using esbuild? Any plugins?
m

Manoel Feliciano

02/01/2022, 11:39 AM
I am not using esbuild I guess. I am using an old version of sst 0.28.1, and “emitDecoratorMetadata” works properly.
m

Matt Morgan

02/01/2022, 2:39 PM
Ah okay. Thanks.