cloudflare / next-on-pages

CLI to build and develop Next.js apps for Cloudflare Pages
https://www.npmjs.com/package/@cloudflare/next-on-pages
MIT License
1.29k stars 125 forks source link

Failed to deploy NextJS@13.2.1 edge runtime - Error: Failed to publish your Function. #109

Closed tengweiherr closed 1 year ago

tengweiherr commented 1 year ago

Failed to deploy NextJS@13.2.1 edge runtime - Error: Failed to publish your Function.

23:31:16.048 |  
23:31:16.102 | AAGresult: null
23:31:16.102 | Uploading... (25/26)
23:31:16.102 |  
23:31:16.103 | AAG Uploading... (26/26)
23:31:16.103 |  
23:31:16.105 | ✨ Success! Uploaded 3 files (23 already uploaded) (1.48 sec)
23:31:16.106 |  
23:31:16.482 | ✨ Upload complete!
23:31:19.554 | Success: Assets published!
23:31:21.022 | 
Error: Failed to publish your Function. Got error: Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.
  at bundledWorker-0.0805608756143057.mjs:2175:18 in o
  at bundledWorker-0.0805608756143057.mjs:2165:210 in ln
  at bundledWorker-0.0805608756143057.mjs:2176:19 in wake
  at bundledWorker-0.0805608756143057.mjs:2192:23 in Nn
  at bundledWorker-0.0805608756143057.mjs:2106:11 in Wr
  at bundledWorker-0.0805608756143057.mjs:2902:16
  at bundledWorker-0.0805608756143057.mjs:2901:9 in registerPlugin
  at bundledWorker-0.0805608756143057.mjs:1747:14 in Gm
  at bundledWorker-0.0805608756143057.mjs:21987:14 in f

This is just a simple NextJS with Contentful CMS webapp, calling getStaticProps and getStaticPaths on built time, not using any Functions. No intention to make it static export because I need to leverage on Next Image optimization and server functions in the future.

Build command: npx @cloudflare/next-on-pages --experimental-minify Build output directory: /.vercel/output/static Root directory: /

Repo: https://github.com/tengweiherr/jamstack-herr.my-edge

"next": "13.2.1" "react": "18.2.0" NODE_VERSION: 16.18.1

lassegit commented 1 year ago

Same here. Using app dir and next v. 13.2.4.

ThuKieuIC2 commented 1 year ago

Can someone try the BuildIO/Qwik plugin solution here: https://github.com/vendure-ecommerce/storefront-qwik-starter (i) create this file /functions)/[[path]].ts

//Point to compiled output Cloudflare Pages Functions
//but need to mix all api in one, here it is idea
export { onRequest } from '../.next/server/pages/api/hello';
dario-piotrowicz commented 1 year ago

Can someone try the BuildIO/Qwik plugin solution here: https://github.com/vendure-ecommerce/storefront-qwik-starter (i) create this file /functions)/[[path]].ts

//Point to compiled output Cloudflare Pages Functions
//but need to mix all api in one, here it is idea
export { onRequest } from '../.next/server/pages/api/hello';

That's quite different from what we do (generate an _worker.js) but it basically produces the same type of result, I doubt it's going to help the situation 😕

Using functions/[[path]].ts also generates some limitations which we want to avoid (since for example it forces your code to get bundled by wrangler which prevents perf improvements like runtime lazy loading)

dario-piotrowicz commented 1 year ago

I've looked into this and is seems like the request handling fails because gsap runs this setTimeout in what I believe is its global setup: gsap wake's setTimeout.

(PS: I did try, and if you remove all gsap usages from your app then it can be successfully deployed)

I think that this is quite likely an issue with gsap SSR on Cloudflare Pages and not next-on-pages specific, for example I did try deploying the first of their sveltekit starters but it's failing deployment, so I think they are just not correctly set for doing SSR in Pages 😕

Surprisingly I did try to run a very simple Remix app using gsap and it seems to be working (repo), so maybe there are instances in which gsap does work and some where it doesn't? (I'm really not familiar with gsap so I am not really sure).

@tengweiherr what do you think? you seem quite familiar with gsap, do you when when and if they do some initial setup? and if you can have a way to delay that until the page is viewed in a browser? (I wonder if converting things to use dynamic imports could help)

justinh00k commented 1 year ago

Not sure if it's the same issue, but I'm using app directory, and everything works in dev and when i run my build locally, but when i deploy with npx @cloudflare/next-on-pages --experimental-minify`, all routes return 404, but the layout runs fine. there's no _worker.js file. any idea how to fix/diagnose?

james-elicx commented 1 year ago

Not sure if it's the same issue, but I'm using app directory, and everything works in dev and when i run my build locally, but when i deploy with npx @cloudflare/next-on-pages --experimental-minify`, all routes return 404, but the layout runs fine. there's no _worker.js file. any idea how to fix/diagnose?

Hello @justinh00k, as you have no worker file, it is not related to this issue. It sounds like one of two things is happening.

If you have any server side functionality, it might only be building functions for the nodejs runtime, and we are therefore not able to find any. This can be fixed by specifying the edge runtime for pages with server side functionality. i.e. export const runtime = 'edge';

Your site is statically generating HTML files at build time for all your pages. In the current routing implementation, we don't handle this scenario properly, and so it won't be able to properly map routes to static HTML files, and also won't find any functions to generate the worker file from. This should be fixed with the new routing system (#129).

Getting a look at the build log will help to confirm either one of these cases.

When you say it works in dev, are you referring to next dev? If so, yeah, it will work as that uses Next.js' own dev server and routing implementation, which is completely different. To test with next-on-pages locally, you need to follow the instruction in the readme.

justinh00k commented 1 year ago

@james-elicx Thanks for your reply. Yes, it only works in next dev and not with next-on-pages (locally or deployed.)

Build output looks like this:

⚡️ @cloudflare/next-on-pages CLI v.0.9.0
⚡️ Detected Package Manager: npm
⚡️ Preparing project...
⚡️ Project is ready
⚡️ Building project...
▲  Vercel CLI 28.20.0
▲  WARNING: You should not upload the `.next` directory.
▲  Installing dependencies...
▲  up to date in 2s
▲  
▲  281 packages are looking for funding
▲  run `npm fund` for details
▲  Detected Next.js version: 13.3.1
▲  Detected `package-lock.json` generated by npm 7+...
▲  Running "npm run build"
▲  > askmi@0.0.1 build
▲  > NEXT_PUBLIC_CF_PAGES_COMMIT_SHA=$CF_PAGES_COMMIT_SHA NEXT_PUBLIC_CF_PAGES_BRANCH=$CF_PAGES_COMMIT_SHA next build
▲  info  - Loaded env from /Users/justinhook/Code/askmi/.env.local
▲  info  - Loaded env from /Users/justinhook/Code/askmi/.env.production
▲  info  - Loaded env from /Users/justinhook/Code/askmi/.env
▲  warn  - You have enabled experimental feature (appDir) in next.config.mjs.
▲  warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
▲  info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback
▲  info  - Creating an optimized production build...
▲  info  - Compiled successfully
▲  info  - Linting and checking validity of types...
▲  info  - Collecting page data...
▲  info  - Generating static pages (0/22)
▲  warn  - Entire page /about deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /about
▲  warn  - Entire page /settings deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /settings
▲  warn  - Entire page /404 deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /404
▲  info  - Generating static pages (5/22)
▲  warn  - Entire page / deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /
▲  warn  - Entire page /surveys/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys/[shortname]
▲  warn  - Entire page /notifications deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /notifications
▲  warn  - Entire page /admin deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /admin
▲  warn  - Entire page /surveys deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys
▲  warn  - Entire page /profile deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /profile
▲  info  - Generating static pages (10/22)
▲  warn  - Entire page /questions deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions
▲  warn  - Entire page /surveys/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  info  - Generating static pages (16/22)
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  warn  - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname]
▲  info  - Generating static pages (22/22)
▲  info  - Finalizing page optimization...
▲  
▲  Route (app)                                Size     First Load JS
▲  ┌ ○ /                                      7.36 kB         656 kB
▲  ├ ○ /_not-found                            0 B                0 B
▲  ├ ○ /about                                 6.13 kB         314 kB
▲  ├ ○ /admin                                 187 kB          577 kB
▲  ├ ○ /notifications                         0 B                0 B
▲  ├ ○ /profile                               434 B           659 kB
▲  ├ λ /profile/[shortname]                   504 B           659 kB
▲  ├ ○ /questions                             1.18 kB         642 kB
▲  ├ ● /questions/[shortname]                 870 B           600 kB
▲  ├   ├ /questions/favorite-color
▲  ├ ○ /settings                              0 B                0 B
▲  + First Load JS shared by all              97.3 kB
▲  ├ chunks/2443530c-eb76b5fe38a88953.js    50.6 kB
▲  ├ chunks/5122-49299bab9dd798df.js        21.2 kB
▲  ├ chunks/8139-3789e2bb3281d5d5.js        23.4 kB
▲  ├ chunks/main-app-498434a275a1a6ba.js    226 B
▲  └ chunks/webpack-ef5ee84685c4d9a6.js     1.88 kB
▲  
▲  Route (pages)                              Size     First Load JS
▲  ─ ○ /404                                   182 B          87.5 kB
▲  + First Load JS shared by all              87.3 kB
▲  ├ chunks/main-90e477eaa3af9d76.js        85.2 kB
▲  ├ chunks/pages/_app-6b94368279a02b5e.js  196 B
▲  └ chunks/webpack-ef5ee84685c4d9a6.js     1.88 kB
▲  λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
▲  ○  (Static)  automatically rendered as static HTML (uses no initial props)
▲  ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
▲  Traced Next.js server files in: 5.413s
▲  Created all serverless functions in: 7.216s
▲  Collected static files (public/, static/, .next/static): 6.719ms
▲  Build Completed in .vercel/output [1m]
⚡️ Completed `npx vercel build`.
⚡️ No functions detected.

I think all of my routes use firebase which I think only works on node, so i don't have any routes that can use edge at the moment, but there are sever server components. The SSG are made with generateStaticParams. The route (app) section has everything I expect but Route (pages) is just 404 which all that loads when deploying with next-on-pages. Does this mean it's issue #129? Would adding an edge route fix it?

james-elicx commented 1 year ago

@james-elicx Thanks for your reply. Yes, it only works in next dev and not with next-on-pages (locally or deployed.)

Build output looks like this: ``` ⚡️ @cloudflare/next-on-pages CLI v.0.9.0 ⚡️ Detected Package Manager: npm ⚡️ Preparing project... ⚡️ Project is ready ⚡️ Building project... ▲ Vercel CLI 28.20.0 ▲ WARNING: You should not upload the `.next` directory. ▲ Installing dependencies... ▲ up to date in 2s ▲ ▲ 281 packages are looking for funding ▲ run `npm fund` for details ▲ Detected Next.js version: 13.3.1 ▲ Detected `package-lock.json` generated by npm 7+... ▲ Running "npm run build" ▲ > askmi@0.0.1 build ▲ > NEXT_PUBLIC_CF_PAGES_COMMIT_SHA=$CF_PAGES_COMMIT_SHA NEXT_PUBLIC_CF_PAGES_BRANCH=$CF_PAGES_COMMIT_SHA next build ▲ info - Loaded env from /Users/justinhook/Code/askmi/.env.local ▲ info - Loaded env from /Users/justinhook/Code/askmi/.env.production ▲ info - Loaded env from /Users/justinhook/Code/askmi/.env ▲ warn - You have enabled experimental feature (appDir) in next.config.mjs. ▲ warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk. ▲ info - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback ▲ info - Creating an optimized production build... ▲ info - Compiled successfully ▲ info - Linting and checking validity of types... ▲ info - Collecting page data... ▲ info - Generating static pages (0/22) ▲ warn - Entire page /about deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /about ▲ warn - Entire page /settings deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /settings ▲ warn - Entire page /404 deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /404 ▲ info - Generating static pages (5/22) ▲ warn - Entire page / deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering / ▲ warn - Entire page /surveys/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys/[shortname] ▲ warn - Entire page /notifications deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /notifications ▲ warn - Entire page /admin deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /admin ▲ warn - Entire page /surveys deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys ▲ warn - Entire page /profile deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /profile ▲ info - Generating static pages (10/22) ▲ warn - Entire page /questions deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions ▲ warn - Entire page /surveys/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /surveys/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ info - Generating static pages (16/22) ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ warn - Entire page /questions/[shortname] deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /questions/[shortname] ▲ info - Generating static pages (22/22) ▲ info - Finalizing page optimization... ▲ ▲ Route (app) Size First Load JS ▲ ┌ ○ / 7.36 kB 656 kB ▲ ├ ○ /_not-found 0 B 0 B ▲ ├ ○ /about 6.13 kB 314 kB ▲ ├ ○ /admin 187 kB 577 kB ▲ ├ ○ /notifications 0 B 0 B ▲ ├ ○ /profile 434 B 659 kB ▲ ├ λ /profile/[shortname] 504 B 659 kB ▲ ├ ○ /questions 1.18 kB 642 kB ▲ ├ ● /questions/[shortname] 870 B 600 kB ▲ ├ ├ /questions/favorite-color ▲ ├ ○ /settings 0 B 0 B ▲ + First Load JS shared by all 97.3 kB ▲ ├ chunks/2443530c-eb76b5fe38a88953.js 50.6 kB ▲ ├ chunks/5122-49299bab9dd798df.js 21.2 kB ▲ ├ chunks/8139-3789e2bb3281d5d5.js 23.4 kB ▲ ├ chunks/main-app-498434a275a1a6ba.js 226 B ▲ └ chunks/webpack-ef5ee84685c4d9a6.js 1.88 kB ▲ ▲ Route (pages) Size First Load JS ▲ ─ ○ /404 182 B 87.5 kB ▲ + First Load JS shared by all 87.3 kB ▲ ├ chunks/main-90e477eaa3af9d76.js 85.2 kB ▲ ├ chunks/pages/_app-6b94368279a02b5e.js 196 B ▲ └ chunks/webpack-ef5ee84685c4d9a6.js 1.88 kB ▲ λ (Server) server-side renders at runtime (uses getInitialProps or getServerSideProps) ▲ ○ (Static) automatically rendered as static HTML (uses no initial props) ▲ ● (SSG) automatically generated as static HTML + JSON (uses getStaticProps) ▲ Traced Next.js server files in: 5.413s ▲ Created all serverless functions in: 7.216s ▲ Collected static files (public/, static/, .next/static): 6.719ms ▲ Build Completed in .vercel/output [1m] ⚡️ Completed `npx vercel build`. ⚡️ No functions detected. ```

I think all of my routes use firebase which I think only works on node, so i don't have any routes that can use edge at the moment, but there are sever server components. The SSG are made with generateStaticParams. The route (app) section has everything I expect but Route (pages) is just 404 which all that loads when deploying with next-on-pages. Does this mean it's issue #129? Would adding an edge route fix it?

Looks like everything is getting generated to static HTML as I suspected, minus /profile/[shortname] which is most likely generating a nodejs lambda function instead. Routing to static HTML pages will be resolved by #129. For your SSR pages (/profile/[shortname]), those need to use the edge runtime, i.e. export const runtime = 'edge';, and then they should work.

justinh00k commented 1 year ago

Unfortunately that route uses Firebase as well.

I tried adding an edge route and the build added my route (of type Streaming), but still got the following error:

 ERROR: Failed to produce a Cloudflare Pages build from the project.
⚡️ 
⚡️      The following functions were not configured to run with the Edge Runtime:
⚡️       - about.func
⚡️ - about.rsc.func
⚡️ - admin.rsc.func
⚡️ - admin.func
⚡️ - index.rsc.func
⚡️ - notifications.func
⚡️ - notifications.rsc.func
⚡️ - index.func
⚡️ - profile.rsc.func
⚡️ - questions.func
⚡️ - questions.rsc.func
⚡️ - profile.func
⚡️ - settings.func
⚡️ - settings.rsc.func
⚡️ - surveys.func
⚡️ - surveys.rsc.func
⚡️ - [shortname].func
⚡️ - [shortname].rsc.func
⚡️ - favorite-color.func
⚡️ - favorite-color.rsc.func
⚡️ 
⚡️      If this is a Next.js project:
⚡️ 
⚡️      - you can read more about configuring Edge API Routes here: https://nextjs.org/docs/api-routes/edge-api-route
⚡️ 
⚡️      - you can try enabling the Edge Runtime for a specific page by exporting the following from your page:
⚡️ 
⚡️              export const config = { runtime: 'edge' };
⚡️ 
⚡️      - or you can try enabling the Edge Runtime for all pages in your project by adding the following to your 'next.config.js' file:
⚡️ 
⚡️              const nextConfig = { experimental: { runtime: 'edge'} };
⚡️ 
⚡️      You can read more about the Edge Runtime here: https://nextjs.org/docs/advanced-features/react-18/switchable-runtime

Does this mean any build with a static route will fail? Is there a timeline on #129? Barring that, is my only option to abandon app directory?

james-elicx commented 1 year ago

Unfortunately that route uses Firebase as well.

I tried adding an edge route and the build added my route (of type Streaming), but still got the following error: ``` ERROR: Failed to produce a Cloudflare Pages build from the project. ⚡️ ⚡️ The following functions were not configured to run with the Edge Runtime: ⚡️ - about.func ⚡️ - about.rsc.func ⚡️ - admin.rsc.func ⚡️ - admin.func ⚡️ - index.rsc.func ⚡️ - notifications.func ⚡️ - notifications.rsc.func ⚡️ - index.func ⚡️ - profile.rsc.func ⚡️ - questions.func ⚡️ - questions.rsc.func ⚡️ - profile.func ⚡️ - settings.func ⚡️ - settings.rsc.func ⚡️ - surveys.func ⚡️ - surveys.rsc.func ⚡️ - [shortname].func ⚡️ - [shortname].rsc.func ⚡️ - favorite-color.func ⚡️ - favorite-color.rsc.func ⚡️ ⚡️ If this is a Next.js project: ⚡️ ⚡️ - you can read more about configuring Edge API Routes here: https://nextjs.org/docs/api-routes/edge-api-route ⚡️ ⚡️ - you can try enabling the Edge Runtime for a specific page by exporting the following from your page: ⚡️ ⚡️ export const config = { runtime: 'edge' }; ⚡️ ⚡️ - or you can try enabling the Edge Runtime for all pages in your project by adding the following to your 'next.config.js' file: ⚡️ ⚡️ const nextConfig = { experimental: { runtime: 'edge'} }; ⚡️ ⚡️ You can read more about the Edge Runtime here: https://nextjs.org/docs/advanced-features/react-18/switchable-runtime ```

Does this mean any build with a static route will fail? Is there a timeline on #129? Barring that, is my only option to abandon app directory?

We've identified a solution to how Vercel generates static routes for the app directory which will receive a PR soon. Note that that solution will be intended to work with the new routing system and will most likely still face 404s in the current routing system.

Opting your app into the edge runtime will be the only way to get it to run at the moment. If your app with server functionality is unable to run on the edge runtime, it probably won't work on Cloudflare pages anyway, as we cannot deploy nodejs functions.

There is no fixed ETA for #129, but it should be coming soon.

mountainash commented 1 year ago

This is should be now fixed.

dario-piotrowicz commented 1 year ago

thanks a lot @mountainash 🙂

Yeah I did test the application with the latest @cloudflare/next-on-pages prerelease and all seems relatively ok 🙂

see: https://f8e90dd0.next-on-pages-test-5h3.pages.dev/

not everything works perfectly, like routing seems to work in MPA mode, also for example the /techblog route returns an internal server error page.

I haven't properly checked the code so I am not sure what and how things should work.

I am closing this issue since the original "Failed to publish your function` error does seem to have been solved, but things are likely not perfect.

@tengweiherr could you please have a look and open separate issues for things you see not working as intended? 🙏 (that would be great but you don't have to, if you don't want or can't, I'll try to make some time to look into things properly later on)