3

I have a next.js application up and runing for a few months on gcp app engine in node standard environment. The last deployment was done around 2 weeks ago and website was loading just fine until this week.

Here are the detected anomalies:

  1. css files randomly stuck as "pending" requests
  2. png files randomly stuck as "pending" requests

enter image description here

Above randomness can be observed under the same instance of Chrome in different tabs.

You can check it over here: https://clanhallroyale.com/

Surpringly, this behaviour does not happen at the build https://seventh-sensor-226609.appspot.com/

Here is app.yaml for the app.

# [START runtime]
runtime: nodejs10

handlers:
- url: /.*
  script: auto
  secure: always
# [END runtime]

There does not seem to be a clear clue of what's might be a problem. How can I tackle this?

halfer
  • 19,824
  • 17
  • 99
  • 186
Festys.rpo
  • 193
  • 1
  • 7

1 Answers1

0

I've experienced the exact same problem. Running next.js app on Google App Engine with custom domain.

  • CSS and Image files randomly (like, once 5 to 10 times I guess) get stuck as "pending"
  • The problem seems not happening on the .appspot.com domain. Only happens on custom domain.

The app is https://tsunotte.com (just in case you want to check it).

What I've done might not perfectly solve the problem, but it seems at least reduce the problem.

I changed the GAE config file(app.yaml) handlers to below:

handlers:
  - url: /_next/static
    static_dir: .next/static
    secure: always
  - url: /static
    static_dir: static
    secure: always
  - url: /.*
    secure: always
    script: auto

By default Next.js serve static files under /static and ./.next/static directory from application server. I configured static files to be served from GAE/SE static server so that the files are served from CDN, which, I think, is the best practice to run Next.js app on production and seemingly reduces the problem in my case.

Check the reference for more detail.

I'm not sure why this problem only happens on custom domain app, and whether this problem not happening until lately or not(because I've configured custom domain for the app 3 days ago).