Hello guys. I have a problem with Epsagon, due it...
# sst
a
Hello guys. I have a problem with Epsagon, due it’s not able to do Tracing to my RDS database. I’m using SST and also TypeORM. I’ve been talking to Support, and they say that I need to configure Webpack.. but not sure how to do so with SST:
Copy code
In this case, you would need to specify aws-sdk and the library you are using for the RDS proxy - as an external to your webpack config
r
If it’s like Thundra, it’s unable to trace the API calls made through the SDK when they’re minified and bundled. So you can set the bundle.nodeModules option to include the necessary SDK libraries or mark as external and provide via a layer (also unbundled - we do it this way)
a
Interesting.
Do you have any link to follow or something?
r
For which part?
a
The external part.
Because looks like the
aws-sdk
is already external by default.
r
we use the v3 SDK but looks like this:
Copy code
bundle: {
      // For Thundra to trace the v3 client calls, they currently need to be not bundled by esbuild,
      // so we externalise
      externalModules: [
        '@thundra/core',
        '@aws-sdk/client-dynamodb',
        '@aws-sdk/client-s3',
        '@aws-sdk/client-ssm',
        '@aws-sdk/client-sqs',
        '@aws-sdk/util-dynamodb',
        '@aws-sdk/lib-dynamodb',
      ],
    },
a
But why?
Copy code
externalModules?
Type : string[], defaults to ["aws-sdk"]
So you say it’s different
@aws-sdk
than
aws-sdk
.
r
Might be a different issue, the V2 aws-sdk is bundled with the lambda runtime whereas the V3 @aws-sdk isn’t
a
Ok.
Epsagon says that I should put external for the library too.
Looks like.
So maybe I have to externalize the
typeorm
?
r
if that’s what is ultimately making the calls, maybe, yeah
a
But if I make it external.. is still part of the bundle?
I don’t know what is external, in this context, sorry.
Going to try adding
typeorm
as external.
r
external is when it’s provided from elsewhere, i.e. via a layer nodeModules is when it’s included with your lambda but isn’t passed through the esbuild process. I.e. sst will just run npm install someLib and leave it at that. I suspect it’s this option you need.
a
Ahh.
Yeah looks like
nodeModule
is what I need.
Thanks for clarifying it.
r
no worries
a
Is possible to do this in
setDefaultFunctionProps
?
r
yeah
a
Nice, found it on
bundle
object.
Amazing.
Looks like this breaks something 😞
Copy code
Error: Cannot find a "package.json" in the function's srcPath: /Users/amouly/Projects/myserverless/backend/src
r
I’m sorry, not familiar with typeorm, I’ve heard it mentioned in here though so maybe someone can help
a
Yeah thank you, going to keep trying.
Ahhh I think I know what’s the problem.
My functions are located in
srcPath: 'backend/src',
But this module is not there, it’s on the root.
So I need one path for the functions, and other path for the modules.
@Frank is this possible to do?
This is my folder structure… my lambdas are in
backend/src
.
@Frank I’m doing what was described above, but getting:
Copy code
Error: Cannot extract version for module 'typeorm'. Check that it's referenced in your package.json or installed.
In SEED.
But in Bitbucket and Local works.