Hi guys, I am using SST together with typeorm, but...
# help
m
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
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
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
Hi @Matt Morgan, I managed to make it work by importing the classes as you said. Thanks for that!
m
Cool, glad it worked! Are you using esbuild? Any plugins?
m
I am not using esbuild I guess. I am using an old version of sst 0.28.1, and “emitDecoratorMetadata” works properly.
m
Ah okay. Thanks.