Skip to content

Browser direct import fails on unresolved #x509-transport-state specifier #2494

Closed

Description

@huanglianggit

Confirm this is a Node library issue

  • This is an issue with the Node library.

Describe the bug

The package's native-browser direct-import path fails before SDK initialization because the emitted ESM contains a bare package-internal import:

import { isTransientX509ConnectionError, markApprovedX509Client } from '#x509-transport-state';

package.json#imports maps this specifier for Node and supporting bundlers, but a browser loading the built openai/index.mjs directly does not resolve package import maps. Chrome reports:

Failed to resolve module specifier #x509-transport-state. Relative references must start with either /, ./, or ../.

This leaves ecosystem-tests/browser-direct-import at Running tests... before any API request.

The regression is also visible in the current main push CI at 6f6411e0 / v7.7.0:

To reproduce

  1. Check out main at 6f6411e0.
  2. Run pnpm install --frozen-lockfile and pnpm build.
  3. Expose the built package under ecosystem-tests/browser-direct-import/public/node_modules/openai, as the existing ecosystem harness does.
  4. Serve ecosystem-tests/browser-direct-import/public and open index.html in Chrome.
  5. Observe the module-resolution error before any API request.

A static confirmation after the build is:

rg -n '#x509-transport-state' dist/client.mjs

which currently reports the unresolved import in dist/client.mjs.

Expected behavior

The repository's native-browser direct-import ecosystem path should load the SDK root module without requiring a page-level import map. Node CJS/ESM behavior and the X.509 state-sharing invariant should remain intact.

Environment

  • OS: Windows 11 locally; Ubuntu GitHub Actions also reproduces the failure
  • Node.js: v24.19.0 locally
  • Library: current main / v7.7.0
  • Browser: Chrome

Activity

  1. mccrearydamion69-crypto commented on Aug 27, 2026

    @mccrearydamion69-crypto

    Hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions