Skip to content

Conversation

@Anishpras
Copy link

Fix Next.js documentation to properly separate server and client configurations for Pinata SDK.

The current documentation incorrectly shows importing server-side config (containing JWT) into client components,
which causes "Attempted to access a server-side environment variable on the client" errors.

Changes:

  • Create separate server-config.ts (with JWT) and client-config.ts (without JWT)
  • Update client-side setup to use client-config that only includes the public gateway URL
  • Add warning about never exposing JWT with NEXT_PUBLIC prefix
  • Clarify that client authentication happens through signed URLs from API routes, not direct JWT usage

This prevents accidental exposure of sensitive API keys to the client and fixes the runtime error users encounter
when following the current documentation.

Anishpras and others added 3 commits September 26, 2025 20:38
 Fix Next.js documentation to properly separate server and client configurations for Pinata SDK.

  The current documentation incorrectly shows importing server-side config (containing JWT) into client components,
  which causes "Attempted to access a server-side environment variable on the client" errors.

  Changes:
  - Create separate server-config.ts (with JWT) and client-config.ts (without JWT)
  - Update client-side setup to use client-config that only includes the public gateway URL
  - Add warning about never exposing JWT with NEXT_PUBLIC prefix
  - Clarify that client authentication happens through signed URLs from API routes, not direct JWT usage

  This prevents accidental exposure of sensitive API keys to the client and fixes the runtime error users encounter 
  when following the current documentation.
@Anishpras Anishpras marked this pull request as ready for review September 26, 2025 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant