Skip to content

[Bug?]: preserve original web Request #1879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
huseeiin opened this issue Apr 8, 2025 · 0 comments
Open
2 tasks done

[Bug?]: preserve original web Request #1879

huseeiin opened this issue Apr 8, 2025 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@huseeiin
Copy link
Contributor

huseeiin commented Apr 8, 2025

Duplicates

  • I have searched the existing issues

Latest version

  • 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 huseeiin added bug Something isn't working needs triage labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant