Joint session with Vercel: How to build intelligent storefronts (May 15th)

TypeError: createClient is not a function in Sanity TypeScript code

46 repliesLast updated: Nov 29, 2025

Hello All... new to Sanity and Typescript so there is probably an obvious answer, but I'm getting this error: TypeError: Object(...) is not a function using this codeimport { createClient } from '
user E/client'import type { ClientConfig } from '
user E/client';
export async function *getIgnoredHandles*() {
const config:
ClientConfig = { projectId: 'project id',
dataset: 'production',
useCdn: false,
// set to
true
to fetch from edge cache
apiVersion: '2023-03-03',
// use current date (YYYY-MM-DD) to target the latest API version }

const client = *createClient*(config);
const response = await client.*fetch*('*[_type == "ignoredHandles"]');

const ignoredHandles: *IgnoredHandle*[] = response.*map*((handle: any) => ({
id: handle.id,
handle: handle.handle,
datereview: handle.datereview
}));

return ignoredHandles;

}

export interface
IgnoredHandle { id: string;
handle: string;
datereview: string;
}
AI Update

Based on the community discussion you've linked to, this error typically occurs due to a version compatibility issue between @sanity/client and your Sanity Studio version.

The Problem:

You're using @sanity/client v5.2.2 with @sanity/core v2.35.6 (which indicates you're on Sanity Studio v2). The issue is that @sanity/client v5+ no longer supports ES5, which can cause problems when working with a v2 Studio.

The Solution:

You have two options:

Option 1: Downgrade to @sanity/client v4 (Quick Fix)

Option 2: Upgrade to Sanity Studio v3 (Recommended)

This is the better long-term solution. Sanity Studio v3 is the current version and works seamlessly with @sanity/client v5+. You can follow the migration guide to upgrade your Studio.

Additional Notes:

The community members who helped solve this were able to identify the version mismatch as the root cause, and upgrading to Studio v3 resolved the issue completely.

Show original thread
46 replies

Was this answer helpful?

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.

Related contributions