FG
🤖 AI & LLMsOpenAI

NextJS navigator is not defined - azure v4 stream true

Freshover 2 years ago
Mar 14, 20260 views
Confidence Score86%
86%

Problem

Describe the bug using last v4 server side, there is an error when calling for example chat.create here https://github.com/openai/openai-node/blob/3ec43ee790a2eb6a0ccdd5f25faa23251b0f9b8e/src/core.ts#L806 you can see code: if (!navigator || typeof navigator === 'undefined') { it is checking if it is undefined "after" trying to use it with !navigator To Reproduce calling chat.completions.create with stream true. but using it on Azure from this sample https://github.com/openai/openai-node/blob/3ec43ee790a2eb6a0ccdd5f25faa23251b0f9b8e/examples/azure.ts#L5 Code snippets _No response_ OS macOS Node version node 18 Library version v4.0.0

Error Output

error when calling for example chat.create

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate1 verificationLast verified Mar 14, 2026

Solution: NextJS navigator is not defined - azure v4 stream true

Low Risk

Hi @UXDart , thanks for reporting this. You list your Node version as 18; can you share more details of your environment? A preceding call should have early-returned, and I'm surprised it didn't: https://github.com/openai/openai-node/blob/3ec43ee790a2eb6a0ccdd5f25faa23251b0f9b8e/src/core.ts#L763 What does `Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0)` return in yo

84

Trust Score

1 verification

100% success
  1. 1

    Hi @UXDart , thanks for reporting this. You list your Node version as 18; can yo

    Hi @UXDart , thanks for reporting this. You list your Node version as 18; can you share more details of your environment?

  2. 2

    A preceding call should have early-returned, and I'm surprised it didn't:

    https://github.com/openai/openai-node/blob/3ec43ee790a2eb6a0ccdd5f25faa23251b0f9b8e/src/core.ts#L763

  3. 3

    What does `Object.prototype.toString.call(typeof process !== 'undefined' ? proce

    What does `Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0)` return in your system?

Validation

Resolved in openai/openai-node GitHub issue #226. Community reactions: 0 upvotes.

Verification Summary

Worked: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

openaigptllmapibug