Critical errors in npm audit for Sanity client @3.3.0 and eventsource @3.2.0

13 replies
Last updated: Jan 28, 2026
Hi everyoneSo I just casually run "npm audit report" and now there are critical errors showing up
My version of sanity client is @3.3.0 and the eventsource is @3.2.0
AI Update

I understand the concern! npm audit warnings can be alarming, but let me help you understand what's happening and how to fix it.

The Issue

You're using @sanity/client version 3.3.0, which is quite outdated (released in 2022). This version depends on eventsource 3.2.0, which has known security vulnerabilities that npm audit is flagging. The eventsource package is used for Server-Sent Events (SSE) functionality in the Sanity client.

The Solution: Upgrade @sanity/client

The best approach is to upgrade to the latest version of @sanity/client. The current version is v6.x, which has resolved these dependency vulnerabilities. Here's what to do:

npm install @sanity/client@latest

Or if you're using yarn:

yarn add @sanity/client@latest

Important Breaking Changes to Consider

Since you're jumping from v3.3.0 to v6.x, there are some breaking changes you'll need to handle:

  1. Import changes: The client now uses named exports

    // Old (v3)
    import sanityClient from '@sanity/client'
    
    // New (v6)
    import {createClient} from '@sanity/client'
  2. Configuration: The API is largely the same, but check the Sanity changelog for any specific features you're using

  3. Node.js version: Make sure you're running Node.js 18 or higher

Why This Matters

While the eventsource vulnerability (CVE/GHSA issues) might not directly affect your application depending on whether you're using listener features, it's good practice to stay reasonably up-to-date with dependencies for security and compatibility reasons. The vulnerability in eventsource 3.2.0 has been addressed in newer versions that the latest @sanity/client uses.

After Upgrading

Run npm audit again to verify the critical vulnerabilities are resolved. You should see a much cleaner report.

If you're working on a large codebase and concerned about breaking changes, you can review what changed between versions by checking the official Sanity changelog or testing in a development branch first.

Show original thread
13 replies

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?