Skip to content

🐞 @sanity/export :: stream.on is not a function #30

@frankleighintercom

Description

@frankleighintercom

Hey everyone 👋

I'm trying to periodically back up my dataset with the @sanity/export package through a Vercel chron job.

const timestamp = new Date().toISOString();
const filePath = `/tmp/sanity-${timestamp}.tar.gz`;

const client = createClient({
  projectId: process.env.SANITY_STUDIO_PROJECT_ID!,
  dataset: "production",
  apiVersion: "2025-06-11",
  token: process.env.SANITY_STUDIO_READ_API_TOKEN!,
  useCdn: false,
});

await exportDataset({
  client,
  dataset: "production",
  outputPath: filePath,
  assets: true,
  drafts: false,
  raw: false,
});

When i ping this endpoint i get the error stream.on is not a function - What am i doing wrong here?

Discord post

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions