solid-start icon indicating copy to clipboard operation
solid-start copied to clipboard

[Bug?]: preserve original web Request

Open huseeiin opened this issue 8 months ago • 0 comments

Duplicates

  • [x] I have searched the existing issues

Latest version

  • [x] I have tested the latest version

Current behavior 😯

getRequestEvent()?.nativeEvent.web?.request.cf?.country

is undefined in wrangler pages dev dist because this isn't the original h3 web request which includes cf properties

Expected behavior 🤔

if you run this in cloudflare, you'll get a string:

import { createApp, toWebHandler } from "h3";

export default {
  fetch: toWebHandler(
    createApp().use("/", (e) => {
      return new Response(e.web?.request?.cf?.country);
    })
  ),
};

Steps to reproduce 🕹

see above

Context 🔦

workaround is getRequestEvent()?.nativeEvent.context

Your environment 🌎


huseeiin avatar Apr 08 '25 13:04 huseeiin