Skip to content

Next.js App Router Standalone Example #307

Open
@ADNolan

Description

@ADNolan

Is your feature request related to a problem?

The existing Next.js App Router (v14) example works well in development mode and the standard Next.js production mode. When it comes to using the standalone output mode, there is seemingly a need for an extra step to ensure that newrelic node package is included in the build output node_modules.

Feature Description

Add an example or documentation for having Newrelic work with the App router in standalone output (i.e. for running in Docker).

Describe Alternatives

The current approach that seems to work is by adding the instrumentation.{js|ts} file and having a import for the newrelic module. Also to set the experimental instrumentation flag in the next config. The other steps outlined in the existing example for the Next.js app router configuration is needed as well.

export async function register(): Promise<void> {
  if (process.env.NEXT_RUNTIME === 'nodejs') {
    await import('newrelic')
  }
}

Additional context

  • None

Priority

Nice to Have

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Reviewed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions