Skip to content

Conversation

@nekomeowww
Copy link
Contributor

@nekomeowww nekomeowww commented Sep 2, 2025

What?

By following the default method to integrate OpenTelemetry in Next.js applications... this error occurs:

'Resource' only refers to a type, but is being used as a value here.

Why?

Resource presented here as a interface or type only definition, as specified in OpenTelemetry's repo, https://github.com/open-telemetry/opentelemetry-js/blob/2d544088ac9a4bcb07986be7d9cdc2d0688e7b44/packages/opentelemetry-resources/src/Resource.ts#L20-L30:

This interface is NOT user-implementable. Valid ways to obtain a {@link Resource} are by using either of these functions

How?

By default, we use resourceFromAttributes for OTEL resources with attributes.

Fixes: #77451

@ijjk ijjk added the Documentation Related to Next.js' official documentation. label Sep 2, 2025
@ijjk
Copy link
Member

ijjk commented Sep 2, 2025

Allow CI Workflow Run

  • approve CI run for commit: 250c1f1

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

@eps1lon eps1lon requested a review from icyJoseph September 2, 2025 07:02
@icyJoseph
Copy link
Collaborator

Hi ~ ty - there's two more things we could do - if you don't mind making a follow up PR:

// next.config.js
  serverExternalPackages: [
    "@opentelemetry/sdk-node",
  ],

Otherwise - a warning like this prints:

 ⚠ ./node_modules/@opentelemetry/sdk-node/build/src/utils.js
Module not found: Can't resolve '@opentelemetry/exporter-jaeger'

This should be part of the docs manual instructions, right after the changes you are making.

Also the two TS/JS snippets above your change, do await import("./instrumentation.node.ts"), but I think the extension is not needed/valid without some assumptions about the project.

@icyJoseph icyJoseph merged commit 9163d25 into vercel:canary Sep 2, 2025
63 checks passed
@nekomeowww
Copy link
Contributor Author

Sure, will check this too. BTW, thanks for merging so quickly.

@icyJoseph
Copy link
Collaborator

Sure, will check this too. BTW, thanks for merging so quickly.

No worries, it had been overdue for a while - and it was relatively easy to verify.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Documentation Related to Next.js' official documentation. locked

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: Optimizing:Opentelemetry should be updated

3 participants