vercel / next.js

The React Framework
https://nextjs.org
MIT License
122.81k stars 26.27k forks source link

Custom server is not necessary in with-firebase-cloud-messaging #20826

Closed VictorAssis closed 3 years ago

VictorAssis commented 3 years ago

What example does this report relate to?

with-firebase-cloud-messaging

What version of Next.js are you using?

10.0.4

What version of Node.js are you using?

12.18.2

What browser are you using?

Chrome and Firefox

What operating system are you using?

Ubuntu 18

How are you deploying your application?

Vercel

Describe the Bug

In the with-firebase-cloud-messaging example, was created a custom server to serve some static files from /.next/ folder in the root scope. But I really dont understand the necessity of this custom server and it disable important performance optimizations (according to this doc page https://nextjs.org/docs/advanced-features/custom-server).

So i created a POC to test if the FCM works without the custom server and works fine (i tested in localhost and on Vercel).

Expected Behavior

The example should not have the custom server.

To Reproduce

I created this repository without the custom server: https://github.com/VictorAssis/with-firebase-cloud-messaging

My question is: does this custom server have any functionality that I am not noticing?

If that is no longer needed, I can create a fork to update the example.

timneutkens commented 3 years ago

The custom server doesn't seem needed indeed. You can achieve the intended effect using rewrites and the public folder nowadays.

lachlanjc commented 3 years ago

It'd be awesome if you made a PR to update that example @VictorAssis! You're totally right.

VictorAssis commented 3 years ago

Thanks for the quick response! PR created.

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.