directus / directus

The flexible backend for all your projects 🐰 Turn your DB into a headless CMS, admin panels, or apps with a custom UI, instant APIs, auth & more.
https://directus.io
Other
27.22k stars 3.81k forks source link

[BUG, v11] UNKNOWN Network Error #23283

Closed koddr closed 1 month ago

koddr commented 1 month ago

Describe the Bug

Every time in Google Chrome (127.0.6533.100, arm64, macOS Sonoma 14.5) when I leave the tab with my Directus instance (Docker), I get this error:

Снимок экрана 2024-08-11 в 11 29 16

Google Chrome's console error output:

index.Cbt_QVmx.entry.js:28 
 GET https://my-domain.net/users/me?fields=id net::ERR_NAME_NOT_RESOLVED

runtime-core.esm-bundler-zlSgKseS.js:13 
 TypeError: Cannot read properties of null (reading 'id')
    at index-CdpNzPja.js:1:2455
    at At.fn (runtime-core.esm-bun…-zlSgKseS.js:9:9380)
    at At.run (runtime-core.esm-bun…-zlSgKseS.js:9:1517)
    at get value (runtime-core.esm-bun…-zlSgKseS.js:9:9624)
    at Ml (runtime-core.esm-bun…-zlSgKseS.js:9:1674)
    at get dirty (runtime-core.esm-bun…-zlSgKseS.js:9:1236)
    at S.c.update (runtime-core.esm-bun…lSgKseS.js:13:42437)
    at We (runtime-core.esm-bun…zlSgKseS.js:13:1381)
    at Fr (runtime-core.esm-bun…zlSgKseS.js:13:3111)

runtime-core.esm-bundler-zlSgKseS.js:13 
 TypeError: Cannot read properties of null (reading 'id')
    at index-CdpNzPja.js:1:7446
    at At.fn (runtime-core.esm-bun…-zlSgKseS.js:9:9380)
    at At.run (runtime-core.esm-bun…-zlSgKseS.js:9:1517)
    at get value (runtime-core.esm-bun…-zlSgKseS.js:9:9624)
    at Ml (runtime-core.esm-bun…-zlSgKseS.js:9:1674)
    at get dirty (runtime-core.esm-bun…-zlSgKseS.js:9:1236)
    at W (runtime-core.esm-bun…lSgKseS.js:13:12506)
    at We (runtime-core.esm-bun…zlSgKseS.js:13:1381)
    at Fr (runtime-core.esm-bun…zlSgKseS.js:13:3111)

index-D0fNzGU9.js:3 
 GET https://mydomain.net/server/info net::ERR_NAME_NOT_RESOLVED

index-D0fNzGU9.js:3 
 GET https://mydomain.net/auth?sessionOnly net::ERR_NAME_NOT_RESOLVED

Error message (from Directus copy-paste button):

{
  "message": "Network Error",
  "name": "AxiosError",
  "code": "ERR_NETWORK",
  "config": {}
}

To Reproduce

  1. Open your Directus instance in Google Chrome;
  2. Login to the admin dashboard;
  3. Go to /admin/settings/data-model page;
  4. Switch Chrome's tab to another website and wait some time;
  5. Return to Directus tab;
  6. Directus redirect you to /admin/login?reason=SESSION_EXPIRED page;
  7. See error.

Directus Version

v11.0.1

Hosting Strategy

Self-Hosted (Docker Image)

Database

PostgreSQL 16

hanneskuettner commented 1 month ago

This error in your browser logs leads me to believe that this is a client side connectivity issue you are experiencing, since the name resolution is handled on the OS side of things and is nothing Directus can influence.

GET https://my-domain.net/users/me?fields=id net::ERR_NAME_NOT_RESOLVED

And if this request fails it is expected that you are redirected to the login page, as it is a way for us to check if the current user is still authenticated.

I'm closing this, as it most likely is a client side problem and nothing we can fix on our end. If you have more information on the problem, that points to Directus, I'm happy to reopen.

koddr commented 1 month ago

@hanneskuettner yes, it's not only a client side problem, it's a UX problem too.

Maybe don't show this "UNKNOWN" error each time? For what? What should I have to know about it? How does it help me to re-login?

I vote to just always redirect to the login screen without this strange & unusable error.

Hope it helps Directus to be more user-friendly at errors 🤗

hanneskuettner commented 1 month ago

Got it! Will reopen this as an improvement request, as I'm fully with you that is should provide you with an easier route to re-login. That being said, I still think the unexpected error information is valuable as it is indeed an unexpected error and not something ordinary that would just normally redirect you to the login screen.