Next.js and GCP Cloud Functions

I've been able to deploy a Next.js application to Cloud Run and GKE, but not to Cloud Functions. I've been banging my head against this challenge for enough time now... Figured I'd ask the community, so here are my questions? Has anyone attempted to get a Next.js project running on GCP Cloud Functions? How was your experience? Were you ever successful? Did you run into any limitations? --- So far I've been able to deploy the project to a cloud function, but when navigating to the provided URL, I get 404's for everything and a blank white screen. Interestingly, the HTML for the project loads successfully, the HTML includes 404 error codes in the JSON data packet, but it is loading the initial HTML. All the 404's are for sources from the .next folder. It took me longer than I would've liked to figure out I needed to provide my own .gcloudignore file so I could override gcloud ignoring the .next folder. Downloading the source of the function, I have confirmed that the .next folder is now included. I've configured next.config.mjs to have an output of standalone and the correct basePath for the given cloud function URL. I'm currently screwing with a custom server, the first issue was that the res object from GCP did not have a setHeader method, so I polyfilled that and there were no more errors being thrown when navigating the to function URL. At this point I have a couple theories: - This is a lot more work than I signed up for, even though I think this is doable, since AWS Lambdas are doable, GCP Cloud Functions should be too, but the deeper I go, it looks like Vercel is doing a lot of "magic" to make that happen - I'm missing something stupidly small Any thoughts?
0 Replies
No replies yetBe the first to reply to this messageJoin