I’ve got this problem where my functions get packa...
# help
m
I’ve got this problem where my functions get packaged according to my filesystem. I guess it’s because I am passing in an absolute path for the 
srcPath
 ? Anything I can do about this?
Error: Cannot find module 'search'
f
Hey @Mischa Spiegelmock , happy new year! Are you getting this in sst start or deploy? Can I see how you are defining the functions, ie.
srcPath
and
handler
? And also can you share a screenshot of the error?
m
I get this error when I try to invoke the lambda. the zip package has the file nested super deep
happy new year!
Copy code
configureLambdaDefaults() {
    const srcPath = getProjectRoot() // absolute path; it's a monorepo

    // default function properties
    this.setDefaultFunctionProps({
      srcPath,
      layers: [getSentryLayerByLang(this)],
      runtime: DEFAULT_RUNTIME,
      // bundle: { minify: true },
      environment: {
        [EnvVars.envName]: this.stage,
        [EnvVars.stackName]: this.stackName,
        DEBUG: "*",
        NODE_ENV: "production",
      },
      bundle: {
        externalModules: [...LAYER_MODULES, ...PRISMA_LAYER_EXTERNAL],
      },
    })

...

 
 appSync.addResolvers(this, {
      "Query searchVacancies2": {
        handler: "packages/service/src/ats/api/graphql/vacancy/search.searchVacancies",
      },
    })
searchVacancies
is bundled with NodejsFunction,
searchVacancies2
is bundled with sst.Function
I’m using this for bundling NodejsFunctions with SST https://github.com/serverless-stack/serverless-stack/pull/1156
t
Yeah it might be an issue with the absolute path
When creating the bundle we try to preserve file paths from your source so source-maps still make sense when exported to something like Sentry
m
oh does it depend on that?
😩
t
By it do you mean sentry? Yeah it does
I need to trim this to be relative to sst.json even if you pass it an absolute path
m
that would be tremendous