GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Sentry Node.js ESM + OTEL instrumentation blockers - Part 3 · Issue #12806 · getsentry/sentry-javascript

Sentry Node.js ESM + OTEL instrumentation blockers - Part 3 #12806

New issue
Copy link
New issue
Copy link
Closed
Closed
Sentry Node.js ESM + OTEL instrumentation blockers - Part 3#12806
Copy link
Assignees
timfishAbhiPrasad
Labels
BugPackage-Meta: OpenTelemetry
Milestone
v8 Instrumentation Issues

Description

@AbhiPrasad
AbhiPrasad
opened on Jul 8, 2024
Issue body actions

With the release of v8 of the Sentry SDK, the Node SDK now relies on OpenTelemetry. OpenTelemetry instrumentation does have some problems though (particularly with ESM because of import-in-the-middle), so this issue aims at documented these gaps.

Part 1: #12242
Part 2: #12485

With 8.15.0 + [email protected] we released most of the fixes for Part 2, but there are a new set of bugs for us to release fixes for. This is tracked in this issue.

### import-in-the-middle PRs to be merged
- [ ] https://github.com/nodejs/import-in-the-middle/pull/115
- [ ] https://github.com/nodejs/import-in-the-middle/pull/142
- [ ] https://github.com/nodejs/import-in-the-middle/pull/140
- [ ] https://github.com/nodejs/import-in-the-middle/pull/145
- [ ] https://github.com/nodejs/import-in-the-middle/pull/146
- [ ] https://github.com/nodejs/import-in-the-middle/pull/148
### Sentry issues
- [ ] https://github.com/getsentry/sentry-javascript/issues/12414
- [ ] https://github.com/getsentry/sentry-javascript/issues/12622
- [ ] https://github.com/getsentry/sentry-javascript/issues/12807
- [ ] https://github.com/getsentry/sentry-javascript/issues/12912

1. openai shims causes issues

Issue: #12414

IITM issue: nodejs/import-in-the-middle#38
Asking about this to Node.js loaders team: nodejs/loaders#198 (comment)

2. CJS identifiers that don't work in ESM break

Issue: #12622

IITM issue: nodejs/import-in-the-middle#94
Fix: nodejs/import-in-the-middle#115

3. Unexpected closing brace error from import-in-the-middle (affects discordjs)

Issue: #12807

Repro: https://github.com/bubooon/sentry-nuxt-nitro-example

4. No spans are created for Node http.get calls in ESM mode

Issue: open-telemetry/opentelemetry-js#4857

Repro: https://github.com/Lms24/otel-node-http-get-esm-reproduction

Activity

  1. AbhiPrasad
    added
    Package: node
    Package-Meta: OpenTelemetry
    on Jul 8, 2024
  2. AbhiPrasad
    added this to the v8 Instrumentation Issues milestone on Jul 8, 2024
  3. AbhiPrasad
    assigned
    timfish
    and
    AbhiPrasad
    on Jul 8, 2024
  4. RIP21 commented on Jul 20, 2024

    @RIP21
    RIP21
    on Jul 20, 2024
    More actions

    Unsure if it's related to the import-in-the-middle but I have problems with drizzle-orm imports.

    Like that

    import { eq, ilike, or } from "drizzle-orm";
             ^^
    SyntaxError: The requested module 'drizzle-orm' does not provide an export named 'eq'
        at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
        at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
        at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
        at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
    
    Node.js v20.13.1
    

    This is how I'm running my node:

     node --import @sentry/node/preload --import @swc-node/register/esm-register ./src/main.ts
    
    Reacted by Sam Yu
  5. getsantry
    added
    Waiting for: Product Owner
    on Jul 20, 2024
  6. getsantry
    added this to GitHub Issues with 👀 3on Jul 20, 2024
  7. getsantry
    moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Jul 20, 2024
  8. timfish commented on Jul 21, 2024

    @timfish
    timfish
    on Jul 21, 2024
    Collaborator
    More actions

    @RIP21 this issue tracked here:

    • @sentry/astro breaks drizzle-orm in Astro #12912
    Reacted by Andrey (Andrii) Los
  9. getsantry
    removed
    Waiting for: Product Owner
    on Jul 21, 2024
  10. getsantry
    moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Jul 21, 2024
  11. timfish commented on Jul 22, 2024

    @timfish
    timfish
    on Jul 22, 2024
    Collaborator
    More actions

    I'm hoping that this import-in-the-middle PR should finally close a lot of these issues:

    • feat: Optionally only wrap modules hooked in --import nodejs/import-in-the-middle#146

    For a bit of context... import-in-the-middle and instrumentation of ESM in Node is fundamentally broken in a couple of ways. Since ES modules are immutable, import-in-the-middle creates wrapper modules for every module which allows for changes to be made after they are loaded. Unfortunately, wrapper modules do not allow import-in-the-middle to fully represent what a regular module looks like to those consuming it.

    The above PR should allow us to signal to import-in-the-middle to only wrap the libraries that we intend to later instrument. While this doesn't fix the fundamental issues surrounding instrumenting ESM, it significantly reduces the number of libraries that import-in-the-middle needs to be compatible with.

    Reacted by Andre de Camargo
  12. AbhiPrasad commented on Sep 9, 2024

    @AbhiPrasad
    AbhiPrasad
    on Sep 9, 2024
    ContributorAuthor
    More actions

    We've released https://github.com/getsentry/sentry-javascript/releases/tag/8.29.0 which includes #13139 as part of this PR.

    As such I think we can close this issue.

    @timfish mind helping follow up on the linked issues?

  13. AbhiPrasad
    closed this as completedon Sep 9, 2024
  14. timfish commented on Sep 9, 2024

    @timfish
    timfish
    on Sep 9, 2024
    Collaborator
    More actions

    Yep and I think many of the issues are assigned to me which should help!

  15. ghost added
    Bug
    on Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @AbhiPrasad
    AbhiPrasad
  • @timfish
    timfish

Labels

BugPackage-Meta: OpenTelemetry

Projects

  • GitHub Issues with 👀 3
    Status
    No status
    Show more project fields

Milestone

  • v8 Instrumentation Issues

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.