Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

nuxt.js - Is there a way to identify error requests in nuxtServerInit?

I have a scenario where my nuxtServerInit is firing multiple times. Two additional requests to be exact.

This issue is exactly what I am experiencing (on an asset exception nuxt is trigging a new request for the error page): https://stackoverflow.com/a/58367668/1949561

Note, I'm not being redirected in the error page, the error is suppressed, I assume since it was simply a request for a font from the scss.

Specifically from two requests from the scss to import fonts from googleapis:

@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Display:ital,wght@0,400;0,500;0,700;0,900;1,400;1,500;1,700;1,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Red+Hat+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap');

Before I fix the root cause, I would like to skip the code that is being executed in the nuxtServerInit for these two "error requests".

However, I can't find any way to identify these two requests as "error requests".

Is there a way to identify in the nuxtServerInit requests that were triggered from an error?

Thanks!

question from:https://stackoverflow.com/questions/66056138/is-there-a-way-to-identify-error-requests-in-nuxtserverinit

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...