Skip to content

chore: Remove deprecated requestInfo.headers API#756

Merged
justinvdm merged 11 commits intomainfrom
rm-deprecated-apis
Sep 25, 2025
Merged

chore: Remove deprecated requestInfo.headers API#756
justinvdm merged 11 commits intomainfrom
rm-deprecated-apis

Conversation

@justinvdm
Copy link
Copy Markdown
Collaborator

@justinvdm justinvdm commented Sep 21, 2025

This change removes two APIs to simplify the developer experience:

  1. The deprecated headers property from the RequestInfo interface.
  2. The undocumented resolveSSRValue helper function.

BREAKING CHANGE: requestInfo.headers removal

The headers property on the RequestInfo object has been removed. All response header modifications should now be done through the response.headers object.

Migration Guide

To update your code, replace any usage of requestInfo.headers with requestInfo.response.headers.

Before:

const myMiddleware = (requestInfo) => {
  requestInfo.headers.set('X-Custom-Header', 'my-value');
};

After:

const myMiddleware = (requestInfo) => {
  requestInfo.response.headers.set('X-Custom-Header', 'my-value');
};

BREAKING CHANGE: resolveSSRValue removal

The resolveSSRValue helper function has been removed. SSR-only functions can now be imported and called directly within Server Actions without this wrapper.

Migration Guide

Remove the resolveSSRValue wrapper and call the SSR function directly.

Before:

import { env } from "cloudflare:workers";
import { ssrSendWelcomeEmail } from "@/app/email/ssrSendWelcomeEmail";
import { resolveSSRValue } from "rwsdk/worker";

export async function sendWelcomeEmail(formData: FormData) {
  const doSendWelcomeEmail = await resolveSSRValue(ssrSendWelcomeEmail);

  const email = formData.get("email") as string;

  if (!email) {
    console.error("❌ Email is required");
    return { error: "Email is required", success: false };
  }

  const { data, error } = await doSendWelcomeEmail(env.RESEND_API, email);

  if (error) {
    console.error("❌ Error sending email", error);
    return { error: error.message, success: false };
  }

  console.log("📥 Email sent successfully", data);
  return { success: true, error: null };
}

After:

import { env } from "cloudflare:workers";
import { ssrSendWelcomeEmail } from "@/app/email/ssrSendWelcomeEmail";

export async function sendWelcomeEmail(formData: FormData) {
  const email = formData.get("email") as string;

  if (!email) {
    console.error("❌ Email is required");
    return { error: "Email is required", success: false };
  }

  const { data, error } = await ssrSendWelcomeEmail(env.RESEND_API, email);

  if (error) {
    console.error("❌ Error sending email", error);
    return { error: error.message, success: false };
  }

  console.log("📥 Email sent successfully", data);
  return { success: true, error: null };
}

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Sep 21, 2025

Deploying redwood-sdk-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 543fcfb
Status: ✅  Deploy successful!
Preview URL: https://7e1de401.redwood-sdk-docs.pages.dev
Branch Preview URL: https://rm-deprecated-apis.redwood-sdk-docs.pages.dev

View logs

@justinvdm justinvdm marked this pull request as draft September 21, 2025 04:34
@justinvdm justinvdm force-pushed the main branch 2 times, most recently from 3feb267 to 302ebf3 Compare September 25, 2025 07:55
@justinvdm justinvdm marked this pull request as ready for review September 25, 2025 10:10
@justinvdm justinvdm merged commit eaaf8c7 into main Sep 25, 2025
6 checks passed
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