Nuxt 3 cold start, random long loading, DNS Resolution/Waiting for server response issue

Hi @Tonyweb

I took a closer look at our logs and it seems we’re serving that request within the expected time, by the time it reaches our network so it must be something on DNS resolution.

Can you please:

Hope this helps!

Hello, thanks for you answer :

- try with a different device/network : thats is the same thing, all the friends I have asked to visit the website have this problem and it’s not the first time, i have another site on Netlify with the same issue : https://bellanger.agence-aurion.fr/

Netlify looks very good, but currently in France, it seems that there are latency issues that prevent me from using it seriously.

You still didn’t answer/try the 2 other options. Netlify works perfectly in France. The fact that it’s taking so long in DNS resolution means that the connection is not even hitting Netlify.

We checked and your DNS is not even being managed by Netlify. You should probably contact your DNS host to find out about the latencies in DNS resolution.

I tried with a VPN but the problem is the same, the first load after a while without going to the site can take more than 10s, once loaded if I refresh the page I have no problem.

Anyway the problem can’t be solved by asking users to have a VPN or to change their DNS. As mentioned before the problem occurs with several people, on several types of computers/phones, on several types of networks.

The domain https://www.leaf-band.com/ and https://bellanger.agence-aurion.fr/ are both hosted on ovh.com, we are a web agency and a lot of the sites we have developed are behind domains hosted on ovh.com pointing to dedicated servers and we have no problems. However, as soon as I point one of these domains to a site hosted on netlify, I get huge latencies.

https://www.agence-aurion.fr/ → Main domain pointing to an ovh server = instant loading.

https://bellanger.agence-aurion.fr/ → Subdomain of the above main domain pointing to netlify = random DNS resolutions issues

Hi, @Tonyweb. It looks like you are trying to delegate the DNS for a subdomain of agence-aurion.fr to Netlify DNS. I say this based on the following recursive query for the IP address for agence-aurion.fr`:

$ dig +trace bellanger.agence-aurion.fr A

; <<>> DiG 9.10.6 <<>> +trace bellanger.agence-aurion.fr A
;; global options: +cmd
.			48633	IN	NS	e.root-servers.net.
.			48633	IN	NS	h.root-servers.net.
.			48633	IN	NS	l.root-servers.net.
.			48633	IN	NS	i.root-servers.net.
.			48633	IN	NS	a.root-servers.net.
.			48633	IN	NS	d.root-servers.net.
.			48633	IN	NS	c.root-servers.net.
.			48633	IN	NS	b.root-servers.net.
.			48633	IN	NS	j.root-servers.net.
.			48633	IN	NS	k.root-servers.net.
.			48633	IN	NS	g.root-servers.net.
.			48633	IN	NS	m.root-servers.net.
.			48633	IN	NS	f.root-servers.net.
.			48633	IN	RRSIG	NS 8 0 518400 20220815170000 20220802160000 20826 . heNj7Re3XSAOExs0gjIUX7r2QlSVLhEb0BL8lHeu50XRFcWN8A1HpXab EHmoH0BpaMmjMMs2AcULkdCq8rFGndxsJ6NIBMppv9P5DtvikOjvG6MJ XiYjl4bdW+UcjEJStrFl2XsHf7gVxVyRug+UyM47ha43kqiDHBf4O+KU 9t1Fcpy6y8qG7HOVFOeSAPdbGSs6R1SjF4HWaP9j+MdCXGPf69yWE7LO q3tphApzpaiDwzGoRH+h2vcJ8WFseNeEPRWf0sssFSwRedC2ri2KVcS4 p3Sy/txy2KNWvHYfuNYYNEe6Ek5X2Yco2vQ5dkWmQXC0O2JSjttsR6Wh 2OOdTg==
;; Received 525 bytes from 8.8.8.8#53(8.8.8.8) in 63 ms

fr.			172800	IN	NS	e.ext.nic.fr.
fr.			172800	IN	NS	f.ext.nic.fr.
fr.			172800	IN	NS	g.ext.nic.fr.
fr.			172800	IN	NS	d.nic.fr.
fr.			86400	IN	DS	51508 13 2 1B3386864D30CCC8F4541B985BF2CA320E4F52C57C53353F6D29C9AD 58A5671F
fr.			86400	IN	RRSIG	DS 8 1 86400 20220816050000 20220803040000 20826 . J3KBO9g49Afy+4a1EvPMzbdDqGHLYdh8Tw/ERR9eeuXPcHfuMt9vnd87 z9y4QB8TIcGHzcoizNEPuq15HEJcqXpHAkf7BCtr1dgE9k4PKQOtk3HZ HNfa0J2kWkpblwL5GJmLjwv9yhK1r0TnSNiuRueuaVtdnb68Qx24jfoh gBs7S1fxvulkms0bVfZcombShtIu5b6Pll7Wlef++Zqef/i9ZHCPR5b/ LjyTh2YxkeGvs9yDclRZLECvjTsQ7+V8lZQnwnnNp/JPq34DYDjGfoAF lPEg/XLsdYdNSiNa5ckSC2r0PneMpZACCJM8CHMRggFJAdh1fIxYfra0 PxnF3A==
;; Received 648 bytes from 192.33.4.12#53(c.root-servers.net) in 47 ms

agence-aurion.fr.	172800	IN	NS	dns101.ovh.net.
agence-aurion.fr.	172800	IN	NS	ns101.ovh.net.
HSE6LVEAKJI7RI5C4E8A03BFG5HA71AO.fr. 5400 IN NSEC3 1 1 1 297E821C HSE6PKPOMG50JK2DK02DRF66LR6OOQFN  NS SOA TXT NAPTR RRSIG DNSKEY NSEC3PARAM TYPE65534
HSE6LVEAKJI7RI5C4E8A03BFG5HA71AO.fr. 5400 IN RRSIG NSEC3 13 2 5400 20220927065636 20220729060347 38791 fr. VQetZeSn14w9pjVjBgxIXJSCG25ys2nngRftLzjfsWuuuZdukWRMqfqf 5NT8qdiWrolbHuXHx+nNQo3eseYyvw==
2SQ7K7R361LMH0I70Q8LK8HGE75646N1.fr. 5400 IN NSEC3 1 1 1 297E821C 2SQBPT1TMR5INJJK4HMMLNPEQMVDJUOP  NS DS RRSIG
2SQ7K7R361LMH0I70Q8LK8HGE75646N1.fr. 5400 IN RRSIG NSEC3 13 2 5400 20220927105206 20220729100457 38791 fr. vz0M/un8H2eAbt5EAksDvQmCs/tCh0wLI9yzuExgTKgtJIa21oqgnoCz TjPjtrejrajWlVV/5rX46HK8eOmKQw==
;; Received 502 bytes from 194.146.106.46#53(f.ext.nic.fr) in 37 ms

bellanger.agence-aurion.fr. 60	IN	NS	dns3.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns4.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns2.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns1.p03.nsone.net.
;; Received 144 bytes from 213.251.188.145#53(dns101.ovh.net) in 157 ms

bellanger.agence-aurion.fr. 20	IN	A	35.247.66.204
bellanger.agence-aurion.fr. 20	IN	A	34.83.23.240
;; Received 87 bytes from 198.51.44.67#53(dns3.p03.nsone.net) in 17 ms

I’m going to repost the section above that shows the subdomain DNS delegation:

bellanger.agence-aurion.fr. 60	IN	NS	dns3.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns4.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns2.p03.nsone.net.
bellanger.agence-aurion.fr. 60	IN	NS	dns1.p03.nsone.net.
;; Received 144 bytes from 213.251.188.145#53(dns101.ovh.net) in 157 ms

That shows the ovh.net name server saying that the name servers (NS type records) for the subdomain are the NS1 name servers (which Netlify DNS is using for DNS infrastructure).

Netlify DNS does not support subdomain delegation. The solution for this will be to delete the DNS zone here:

https://app.netlify.com/account/dns/agence-aurion.fr

and to use the external DNS instructions below instead:

Alternatively, you can move the DNS service for the domain to Netlify but that is optional and not a requirement in any way. If you want to use Netlify DNS, please be sure you have copied all existing and required DNS records to Netlify before changing the name severs for the domain at the registrar.

If there are other questions about this or if either solution above does not work, please let us know.

1 Like

Thank you, it sounds like a nice start to solve my issue, i will check that in the next few days

1 Like

Ok, so I removed the DNS from this page:

To add the dns on ovh directly :

Was that the right thing to do?

Because I always have this problem of cold start when I go on https://bellanger.agence-aurion.fr/ after a certain time the site takes several seconds to be displayed, then once displayed all the following refreshments (f5) will be instantaneous.

Hey @Tonyweb,

You need to go here: Netlify App, scroll to the end and click on “Delete DNS Zone” to get rid of that. That’s not causing trouble with this problem anymore, but it’s worth removing it anyways.

To solve the actual issue, would you mind sharing the HAR file that shows a slow load? That would help us make sure we’re all looking at the same issue.

Additionally, I can see that you’re using Nuxt 3 with Netlify Functions preset (default), and that’s probably going to be slower than the alternative Netlify Edge Functions preset. You can configure this preset by using:

nitro: {
  preset: 'netlify-edge'
}

(if I recall correctly)

That’s expected to be faster than Netlify Functions. However, last time I had used it, Nuxt.js did not work and gave me the error mentioned here:

Since the issue is still open, I am assuming it has not been fixed, but you’re free to try.

Hello,

I tried the Netlify Edge Functions preset but i got and error when building on Netlify :

12:19:43 PM: ────────────────────────────────────────────────────────────────
12:19:43 PM:   Bundling of edge function failed                              
12:19:43 PM: ────────────────────────────────────────────────────────────────
12:19:43 PM: ​
12:19:43 PM:   Error message
12:19:43 PM:   There was a problem setting up the Edge Functions environment. To try a manual installation, visit https://ntl.fyi/install-deno.
12:19:43 PM: ​
12:19:43 PM:   Error location
12:19:43 PM:   While bundling edge function

My nuxtconfig :

nitro: {
    preset: "netlify-edge",
  },

I will concentrate my tests about DNS on https://www.leaf-band.com/ wich is also on netlify. I will try to get you a HAR file from it too.

Hey there, @Tonyweb :wave:

Thanks for your patience. We have opened an issue with one of our teams to investigate this further. In the interim, I believe the best path forward is to keep the app loading slowly with your original approach, versus keeping the functions error while bundling.

When we have more information a member of the team will follow up here. Do not hesitate to reach out in the interim if anything changes!

Hello, do you have any news with this issue ?

Using the preset “netlify-edge” for the nitro engine should probably resolve the issue (not tested yet because one of my dependencies is using axios and thats not supported within DENO V8).

What I came up with was to request a region change to eu-central-1 or near your region: Changing deployment region?

Afterwards the cold start was drastically reduced, not perfect but reduced.

Hey folks! Happy to update the functions region for you (but that will only affect lambda functions, not edge functions, just as an FYI - and we’ll only be able to do it for customers with a Pro or higher team, just to set expectations).

This post describes what a teammate mentioned when we raised this issue:

  • this is just a workaround, but may help you get things working at least!

Please let us know if that helps out at all!

If you do

Hey, i tried with preset “netlify-edge” but i had somes 404 issues with js and css bundles. So I went back for the moment. Cold start still here. Im using the latest version of nuxt 3 (rc11)

Hi @fool, im not using pro account, i can’t update the functions region i guess. There is more a technical issue here, something from netlify with Nuxt. Netlify technical teams should investing on that.

Hey @Tonyweb I’m wondering if you tried the workaround that @fool mentioned here:

Syntax Error during deploy --build command step bundling EdgeFunctions - #12 by danez

I know you mentioned that the preset netlify-edge didn’t work, but if you can let us know if that workaround made a difference, that would help us troubleshoot further.

Hi, this does not seem to be related to my problem.

Someone at Netlify should really investigate this, I have randomly extremely long load times for no logical reason.

In the example below you can see two loads of the same page, the first one was done on Wed, 19 October 2022 16:44:10 and the second on Wed, 19 October 2022 16:45:31, 1min20 apart!

And the second loading takes 8.62s …

image

First one ( x-nf-request-id: 01GFRJ32516QKENW5ZEGFPZWRW) :

Second one ( x-nf-request-id: 01GFRJ5HCZXARB7ZT13JE8MW17)

There’s a not we can investigate here @Tonyweb, we’ve already mentioned that. There are 2 main reasons for that:

  1. We cannot replicate this issue.
  2. This is not a problem with Netlify.

How do I know about point 2? It’s because the 8 second wait time is during DNS lookup - your screenshot shows that!

Pasted_Image_20_10_22__9_01_PM

The server (Netlify) is taking just about 500 ms to serve the response!

As already mentioned above, this is something you’d have to sort with your DNS provider.

For those who will have DNS and TTFB problems with Netlify and will see this post :

  • Replace ALIAS by CNAME fix DNS issues (with my provider : OVH)
  • After that i always have huge TTFB, switching to Vercel fix that for me.