Skip to content

fix(web): send session cookies on playground/agent generate requests#5703

Open
Taranum01 wants to merge 1 commit into
Helicone:mainfrom
Taranum01:fix/playground-credentials-5653
Open

fix(web): send session cookies on playground/agent generate requests#5703
Taranum01 wants to merge 1 commit into
Helicone:mainfrom
Taranum01:fix/playground-credentials-5653

Conversation

@Taranum01

Copy link
Copy Markdown

Summary

  • Add credentials: "include" to the Playground/Agent generate() fetch so Better Auth session cookies reach Jawn on cross-origin self-hosted deployments (localhost:3000:8585).
  • Forward params.signal to fetch so streaming cancel works as intended.

Closes #5653

Problem

Self-hosted Playground returns 401 Invalid session on POST /v1/playground/generate even when the user is logged in. Other dashboard Jawn calls succeed because they use getJawnClient(), which always sends credentials: "include". The Playground path uses a raw fetch() without credentials, so the session cookie is omitted and BetterAuthWrapper.getSession() fails.

Test plan

  • Self-hosted all-in-one: log in, open Playground, click Run — request includes Cookie header and does not return Invalid session
  • Agent chat generate path (/v1/agent/generate) works in self-hosted Better Auth mode
  • Cloud/hosted Helicone Playground still works
  • Cancel mid-stream still aborts the request

Made with Cursor

Self-hosted Better Auth requires the session cookie on cross-origin Jawn
calls; the Playground generate path omitted credentials: include unlike
getJawnClient(), causing Invalid session on /v1/playground/generate.

Fixes Helicone#5653

Co-authored-by: Cursor <cursoragent@cursor.com>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Helicone Team on Vercel.

A member of the Team first needs to authorize it.

@vercel vercel Bot temporarily deployed to Preview – helicone-bifrost June 27, 2026 18:47 Inactive
@vercel

vercel Bot commented Jun 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
helicone-bifrost Skipped Skipped Jun 27, 2026 6:47pm

Request Review

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.

Self-hosted Playground returns Invalid session on /v1/playground/generate

1 participant