-
Notifications
You must be signed in to change notification settings - Fork 554
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃悰 BUG: pages dev
HTTP 406 on env.ASSETS.fetch()
#370
Comments
I also ran into this issue today when attempting to migrate an older Workers Sites project. My use-case here is an Reproduction repo: https://github.com/Cherry/universe-horse-test EDIT: I managed to hack around it by doing this instead: Cherry/universe-horse-test@1e1b67c. |
I run across the same issue and can confirm this nasty bug. I got referenced to this issue from a topic in the Cloudflare community forum: My use-case is trying to load a YAML file from my cloudflare pages project within a functions middleware (that is part of the same project). The code worked locally (using wrangler pages dev), but not in production! |
@falcon03, a workaround for this problem could look like this: export const onRequestGet: PagesFunction<{}> = async ({ request }) => {
return fetch("./myfile.yaml", request.url)
}; This does a regular fetch request, which piggybacks off the incoming request's URL. Of course, this requires that your YAML file publicly accessible. This would results in fetching I haven't tried Cherry's answer, but that should work too. |
This impacted another user in the Discord today: https://canary.discord.com/channels/595317990191398933/910978223968518144/1004857593656786974 Can we get some eyeballs on this issue please? It's a massive prod vs development issue when doing anything slightly advanced within Functions. |
This doesn't just impact // functions/testing.js
export async function onRequestGet({request, next}){
const url = new URL(request.url);
url.pathname = '/test';
return next(url.toString());
} |
I'm no longer able to reproduce this - it seems to be resolved. |
Closing for now. |
What version of
Wrangler
are you using?0.0.15
What operating system are you using?
Windows
Describe the Bug
Try this:
Run
wrangler pages dev ./
Works as expected on Wrangler, fetches the index page for
https://some-page.dev/
. On Pages,env.ASSETS.fetch()
returns a406
error with no body. I've confirmed that it isenv.ASSETS.fetch()
that's returning the error, and that the worker isn't just dying.Here's an example response:
The text was updated successfully, but these errors were encountered: