Isaac McFadyen | YYZ01
02/20/2022, 4:31 PMErisa | Support Engineer
02/20/2022, 4:33 PMErisa | Support Engineer
02/20/2022, 4:34 PMErisa | Support Engineer
02/20/2022, 4:34 PMErisa | Support Engineer
02/20/2022, 4:35 PMRaifY
02/20/2022, 4:37 PMErisa | Support Engineer
02/20/2022, 4:38 PMErisa | Support Engineer
02/20/2022, 4:38 PMGreg Brimble | Cloudflare Pages
02/20/2022, 4:39 PMErisa | Support Engineer
02/20/2022, 4:40 PMGreg Brimble | Cloudflare Pages
02/20/2022, 4:41 PMRaifY
02/20/2022, 5:06 PMinstanceof File
not work after importing the polyfill. I'm trying to patch the prototype of built-in File classKedas
02/20/2022, 5:29 PMjs
let n = await next()
if(!n.headers.get("Content-Type") || !n.headers.get("Content-Type").includes("text/html")) {
return n
}
and it's been giving me an error, but the stacktrace doesn't give me anything useful and it only gives me an error on some of the requests, seemingly at random.
alternatively, is there a way to exclude a static file from being handled by a wildcard function?Greg Brimble | Cloudflare Pages
02/20/2022, 5:44 PMn.headers.get("Content-Type")
is null, so you can't call .includes("text/html")
on it. Try this instead:
if(!n.headers.get("Content-Type") || !n.headers.get("Content-Type")?.includes("text/html")) {
Greg Brimble | Cloudflare Pages
02/20/2022, 5:45 PMKedas
02/20/2022, 5:45 PM!n.headers.get("Content-Type")
?Greg Brimble | Cloudflare Pages
02/20/2022, 5:48 PMGreg Brimble | Cloudflare Pages
02/20/2022, 5:48 PM.includes
anywhere else in your Functions?Kedas
02/20/2022, 5:52 PMKedas
02/20/2022, 6:07 PMnpx wrangler pages dev --proxy 3000 ./build -- npm run dev
but it just serves the build folder and doesn't even run the commandGreg Brimble | Cloudflare Pages
02/20/2022, 7:34 PMKedas
02/20/2022, 7:35 PMGreg Brimble | Cloudflare Pages
02/20/2022, 7:35 PMGreg Brimble | Cloudflare Pages
02/20/2022, 7:36 PMwrangler@alpha
.Kedas
02/20/2022, 7:36 PMLarry
02/21/2022, 12:06 AMenv.ASSETS.fetch('your/file.json')
Kieran Huggins
02/21/2022, 12:07 AMKieran Huggins
02/21/2022, 12:23 AMLarry
02/21/2022, 1:01 AMnew URL(request.url).origin + '/your/file.json'
Greg Brimble | Cloudflare Pages
02/21/2022, 1:15 AM