Skip to content

Leftover from polyfill removal: web-streams-polyfill #1083

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
tobias-schwerdtfeger opened this issue Sep 18, 2024 · 4 comments
Closed
1 task done

Leftover from polyfill removal: web-streams-polyfill #1083

tobias-schwerdtfeger opened this issue Sep 18, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@tobias-schwerdtfeger
Copy link

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

Just updated to the latest version and encountered this during a build:

node_modules/openai/_shims/node-types.d.ts:10:32 - error TS2307: Cannot find module 'web-streams-polyfill' or its corresponding type declarations.

10 export { ReadableStream } from 'web-streams-polyfill';
                                  ~~~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/openai/_shims/node-types.d.ts:10

I guess it's a leftover from #954 and should be export { ReadableStream } from 'node:stream/web';

To Reproduce


Code snippets

No response

OS

macOS

Node version

Node v20.15.1

Library version

openai v4.62.0

@tobias-schwerdtfeger tobias-schwerdtfeger added the bug Something isn't working label Sep 18, 2024
@RobertCraigie
Copy link
Collaborator

RobertCraigie commented Sep 18, 2024

Thanks for the report, could you share your tsconfig.json / package.json? I'm not sure how we didn't catch this earlier

@tobias-schwerdtfeger
Copy link
Author

Here's the package.json:

{
  "name": "...",
  "scripts": {
    "build": "tsc -p ./tsconfig.json && tsc-alias -p ./tsconfig.json",
  },
  "engines": {
    "node": "20"
  },
  "type": "module",
  "exports": "./lib/index.js",
  "main": "lib/index.js",
  "dependencies": {
    "openai": "4.62.0",
    "firebase-admin": "^12.1.0",
    "firebase-functions": "^5.0.0",
    "async": "3.2.5",
    "async-mutex": "0.5.0",
    "zod": "3.23.8",
    "patch-package": "8.0.0"
  },
  "devDependencies": {
    "@trivago/prettier-plugin-sort-imports": "4.3.0",
    "@types/async": "3.2.24",
    "@types/jest": "29.5.12",
    "@typescript-eslint/eslint-plugin": "7.6.0",
    "@typescript-eslint/parser": "7.6.0",
    "concurrently": "8.2.2",
    "eslint": "8.57.0",
    "eslint-config-google": "0.14.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-plugin-import": "2.29.1",
    "prettier": "3.2.5",
    "ts-jest": "29.1.2",
    "tsc-alias": "1.8.8",
    "typescript": "5.4.5"
  },
  "private": true
}

And the tsconfig.json:

{
  "compilerOptions": {
    "module": "nodenext",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2022",
    "esModuleInterop": true,
    "allowJs": true,
    "paths": {
      "@/*": ["./src/*"]
    }
  },
  "compileOnSave": true,
  "include": ["src"]
}

@RobertCraigie
Copy link
Collaborator

Thanks! Will be shipping a fix for this shortly

@RobertCraigie
Copy link
Collaborator

@tobias-schwerdtfeger this should be fixed in v4.62.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants