Skip to content
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

🧪 TypeError: API.Completions is not a constructor #9

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

NatoBoram
Copy link
Owner

@NatoBoram NatoBoram commented Jun 12, 2024

This reproduces the error API.Completions is not a constructor in a minimal project that mimics some real-world requirements, such as loading environment variables and starting an Express server.

Before this pull request

Node.js CI

  • OpenAI is installed
  • Sentry is installed and preloaded
  • The pipeline confirms that the project is working as expected

In this pull request

Node.js CI

  • OpenAI is called with new OpenAI()
  • A test is added to make sure that it is possible to call new OpenAI()
  • The pipeline fails at running dist/index.js
  • The unit test index.test.ts fails or timeouts
❯ node --import @sentry/node/preload ./dist/index.js
TypeError: API.Completions is not a constructor
    at new OpenAI (file:///home/nato/Code/github.com/NatoBoram/bug-report-sentry/node_modules/.pnpm/[email protected]/node_modules/openai/index.mjs:46:28)
    at file:///home/nato/Code/github.com/NatoBoram/bug-report-sentry/dist/openai.js:3:23
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:474:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)
(node:368685) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

@NatoBoram NatoBoram merged commit 14d8e26 into main Jun 28, 2024
1 check passed
@NatoBoram NatoBoram deleted the bugreport/openai branch June 28, 2024 20:31
@NatoBoram
Copy link
Owner Author

Confirmed fixed in Sentry v8.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant