Cloudflare pages build/bundling issue

My app works as intended in development. However. When i build it for cloudflare pages using nitro presets and I run it with wrangler pages dev dist/ I have 2 endpoints that are problematic: /api/user/me and /api/user/repositories/list Both gets data from github api, (i tried with octokit.js and $fetch). However: After building for cloudflare pages. It seems that only one or the other endpoint works. I get the errors: When using octokit on the server: "Object prototype may only be an Object or null: undefined", OR When using $fetch on the server: 403 Forbidden -> cf pages runtime seems to strip my user agent and the request fails. on development and production If this error happens on /api/user/repositories/list, my endpoint /api/user/me is working and vice versa.. For the 1st error, i tried returning functions and clean types everywhere but it never seems to work once bundled for cloudflare pages. Could anyone help me on this one ? I checked a lot of the docs of nuxt, nitro, wrangler and cloudflare pages and can't seem to find much to debug this one and it seems to point out to a bundling/build issue with nitro imo ! code snippets here 🙂 : https://gist.github.com/mickaelicoptere/c40d9bff314721e9c3fb3602926318d6 Cheers
Gist
nuxt3, nitro & cf pages : Object prototype may only be an Object o...
nuxt3, nitro & cf pages : Object prototype may only be an Object or null: undefined - list.post.ts
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server