Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on demand entries question #1364

Closed
abstracthat opened this issue Mar 6, 2017 · 19 comments
Closed

on demand entries question #1364

abstracthat opened this issue Mar 6, 2017 · 19 comments
Assignees

Comments

@abstracthat
Copy link

Is there anyway to prevent my console from filling up with Fetch complete: GET "http://localhost:3003/_next/on-demand-entries-ping?page=/". while in development? With a new ping every 5 seconds my console gets quite noisy rather quickly.

@rauchg
Copy link
Member

rauchg commented Mar 6, 2017

I'm thinking we can use new Image().src maybe instead of XHR just to avoid the horrible XHR logs?

@arunoda arunoda self-assigned this Mar 7, 2017
@arunoda
Copy link
Contributor

arunoda commented Mar 7, 2017

@abstracthat what's your browser?
In chrome, we can't see this GET request in the console, but in the network tab.

@rauchg Even we use an image, it's the same doing fetch. Network request will be there and when there's a 404 error, it'll log into the console.

@abstracthat
Copy link
Author

Chrome 56. I don't believe I've configured anything special to show those requests. Typically I enjoy seeing what requests are being made.

image

I've found I can also hide these without too much trouble but for a new user I could see it being a bit annoying.

image

@albinekb
Copy link
Contributor

Why is this not done over sockets? 🤔

@arunoda
Copy link
Contributor

arunoda commented May 31, 2017

@albinekb because of the custom server support, creating WS server inside the same port seems challenging.
But I like to introduce a new port and server for this.

@aesopwolf
Copy link

Adding ^((?!on-demand-entries).)*$ to the network filter is my solution for the time being.

image

@bhavin-prajapati
Copy link

Is there a way to prevent these calls from happening?

@timneutkens
Copy link
Member

@bhavin-prajapati no there isn't. If this relates to your other comment, this is disabled in production mode too 😄

@donaminos
Copy link

Hi guys, I am using Next for my project and I went through this issue that I do not understand quite well.
Could someone explain to me please the purpose of on-demand-entries-ping ?
Thanks

@albinekb
Copy link
Contributor

albinekb commented Nov 3, 2017

It is there to ping for updates when you change your code to make it faster from changed code to updated code running in your browser @donaminos

@donaminos
Copy link

Thank you very much @albinekb

@ghengeveld
Copy link

The Regex checkbox seems to be missing in newer versions of Chrome. You now need to add a leading and trailing slash to use Regex:

I'll update the Wiki page.

@timneutkens
Copy link
Member

Not sure if this still an issue. Chrome now squashes multiple requests to the same url 🤔

@TrebuhD
Copy link

TrebuhD commented Apr 9, 2018

Yeah, still an issue, at least in the network tab. I think Chrome only squashes console logs.

@timneutkens
Copy link
Member

Any other implementation (like @rauchg's suggestion for an <img> tag) would still end up in the Network tab.

@albinekb
Copy link
Contributor

albinekb commented Apr 9, 2018

Sockets would only show up as one connection (on page load) I think @timneutkens

@ghengeveld
Copy link

ghengeveld commented Apr 9, 2018

I suggest long polling or server sent events instead of websockets. Probably the first is less work to implement.

@rauchg
Copy link
Member

rauchg commented May 29, 2018

Prioritizing this now.

@albinekb
Copy link
Contributor

albinekb commented Sep 3, 2018

See #4495

timneutkens pushed a commit that referenced this issue Dec 14, 2018
Fixes #4495

Here's my approach for replacing the XHR on-demand-entries pinger #1364 #4495. I'm not sure if this is the way everyone wants to accomplish this since I saw mention of using a separate server and port for the dynamic entries websocket, but thought this would be a fairly clean solution since it doesn't need that.

With this method the only change when using a custom server is you have to listen for the upgrade event and pass it to next.getRequestHandler(). Example: 
```
const server = app.listen(port)
const handleRequest = next.getRequestHandler()

if(dev) {
  server.on('upgrade', handleRequest)
}
```
@lock lock bot locked as resolved and limited conversation to collaborators Sep 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants