Skip to content

APIConnectionError does not pass message argument #1656

@uinstinct

Description

@uinstinct

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

The library always returns Connection Error when hitting an invalid url instead of the full error from fetch (such as "ADDRINFO not found" or similar). This is happening because this line does not pass the message parameter required in APIConnectionError which makes message undefined and resulting in the fallback string - "Connection error".

To Reproduce

  1. Setup OpenAI client with a custom fetch function returning a random error - "this fn does not make req"
  2. Make a request with the client
  3. The error is always "connection error" irrespective of what the fetch function contains.

Code snippets

OS

macos

Node version

20.19.0

Library version

openai v5.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions