Skip to content

React Router v7 Framework Instrumentation instructions using AWS CDK Lambda NodejsFunction #18095

@MattyBalaam

Description

@MattyBalaam

Problem Statement

I’ve been really struggling to work out how to add instrumentation to an app built using aws-cdk-lib/aws-lambda-nodejs and NodejsFunction.

Basically this bundles up all the files using esbuild and puts them into an output directory and I have been trying to use '-import ./instrument.server.mjs' on NODE_OPTIONS, but to use this we then need to copy over instrument.server.mjs to the output folder. However this opens up a new problem wherbey there are missing node_modules.

Solution Brainstorm

Solutions I have tried:

  • Copy over packages needed to a new node_modules fiolder - there is a chain of dependencies so this was not possible.
  • Copying the entire node_modules folder - we have a monorepo with lots of packages so this is not really practical.
  • Bundle using tsdown - this complains that there are non-JS packages which can’t be bundled.

Additional Context

Tip: React with 👍 to help prioritize this improvement. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Community

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions