
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeI'd love to help you get past this error! I can see you're following Kapehe's Next.js 13 & Sanity Studio v3 tutorial, which is a great resource for building a personal portfolio site.
Since you mentioned the admin section (Sanity Studio) works fine but you're having issues when setting up page.tsx to display projects, here are the most common issues and solutions:
1. Environment Variables
Make sure your .env.local file in your Next.js project root contains:
NEXT_PUBLIC_SANITY_PROJECT_ID=your-project-id NEXT_PUBLIC_SANITY_DATASET=production NEXT_PUBLIC_SANITY_API_VERSION=2024-01-01
2. GROQ Query Syntax
If you're using TypeScript, queries need to be wrapped with defineQuery:
import { defineQuery } from 'next-sanity'
const projectsQuery = defineQuery(`*[_type == "project"]`)3. Sanity Client Configuration
Verify your Sanity client is properly configured with your project ID and dataset. Check your sanity.config.ts or client initialization file.
4. CORS Settings If you're getting network errors, add your localhost to CORS origins:
http://localhost:3000 (or whatever port you're using)5. Next.js Version Differences The tutorial uses Next.js 13, but if you're on Next.js 15, be aware that route params are now promises and need to be awaited:
// Next.js 15
export default async function Page({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
}6. API Perspective Change
If you're using the latest Sanity APIs, note that the default perspective changed to published in API version 2025-02-19. You might need to explicitly set the perspective to raw if you want to see drafts.
To give you more specific help, could you share:
page.tsx code where you're fetching projectspackage.json)The fact that this happens on both Mac and Linux suggests it's a configuration or code issue rather than an environment problem. Drop the error details here and I'll help you troubleshoot further!
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store