Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

DurableObject Request::url() is different than Cloudflare's implementation #27

Closed
halzy opened this issue Aug 8, 2021 · 4 comments
Closed
Labels
behaviour mismatch Different behaviour to Workers runtime fixed-in-next Fixed in next release

Comments

@halzy
Copy link

halzy commented Aug 8, 2021

The request object passed into fetch(request, env) does not return a full URL for url().

Cloudflare always gives a full URL (ie: https://fake-host/foobar) , miniflare omits everything before the path (ie: /foobar)

@mrbbot
Copy link
Contributor

mrbbot commented Aug 9, 2021

👋 Hmmm, with the following worker script...

// index.mjs
export default {
  fetch(request, env) {
    console.log(request.url);
    return new Response();
  },
};

...visiting http://127.0.0.1:8787/path after running miniflare index.mjs --watch --debug logs http://127.0.0.1:8787/path to the console, not /path. Could there be something going on in your Rust code?

@gsbhalsted
Copy link

It's not the worker script handler, it's the DurableObject handler.

@mrbbot
Copy link
Contributor

mrbbot commented Aug 10, 2021

Ah, whoops, didn't read that properly. 😅 I'm able to reproduce this, so will aim to get it fixed for the next release.

@mrbbot mrbbot added the behaviour mismatch Different behaviour to Workers runtime label Sep 27, 2021
@mrbbot mrbbot added the fixed-in-next Fixed in next release label Oct 19, 2021
@mrbbot
Copy link
Contributor

mrbbot commented Oct 27, 2021

Hey! 👋 The first pre-release of Miniflare 2 has just been released, including this change. Miniflare 2 also does some proxy-trickery with instanceof so code generated by wasm-bindgen for checking if things are instanceof Object for example should now work more reliably. You can find the full changelog here and install it with npm i miniflare@next -D. Please let me know if you have any other issues, and feel free to ask questions in the #miniflare channel of the Cloudflare Workers Discord server.

@mrbbot mrbbot closed this as completed Oct 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
behaviour mismatch Different behaviour to Workers runtime fixed-in-next Fixed in next release
Projects
None yet
Development

No branches or pull requests

3 participants