I get intermittent 'field_id not found' errors. On my local machine, doing a manage.py runserver, everything works fine. However, in my docker container it only works once every few requests.
If I start typing in my autocomplete field, I see ajax requests going to /select2/fields/auto.json?term=ange&field_id=IjVkOTJjOTE.. for example. If I just start typing something that is in the list, then most of the time it'll say 'the results could not be loaded', but every now and then upon typing, it'll output a response.
If I open up my browser's network inspect tool, I see most requests return a 404 'field_id not found', and some will return a 200 with the json. But all the requests are identical, except for the search term.
I don't understand why it's throwing these errors!
These exact versions are the same in the docker image.
On my dev machine I run manage.py runserver. In the docker image I have a simple nginx config with gunicorn running. A single container, no balancing, no caching components, no caching configuration in django (so the default LocMemCache is used).
See this nginx output for example, you see a lot of 404's, with a few 200's in between:
172.19.0.4 - - [22/Dec/2023:13:16:47 +0000] "GET /select2/fields/auto.json?term=an&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1551 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:48 +0000] [20] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:48 +0000] "GET /select2/fields/auto.json?term=ane&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1552 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:48 +0000] [20] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:48 +0000] "GET /select2/fields/auto.json?term=an&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1551 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:48 +0000] [24] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:49 +0000] "GET /select2/fields/auto.json?term=ang&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1551 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:49 +0000] [20] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:49 +0000] "GET /select2/fields/auto.json?term=ange&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1552 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:49 +0000] [21] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:49 +0000] "GET /select2/fields/auto.json?term=angel&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1553 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:50 +0000] [21] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:50 +0000] "GET /select2/fields/auto.json?term=angelo&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1553 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:51 +0000] [22] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:51 +0000] "GET /select2/fields/auto.json?term=angel&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1553 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:51 +0000] [22] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:51 +0000] "GET /select2/fields/auto.json?term=ange&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1552 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:52 +0000] [21] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:52 +0000] "GET /select2/fields/auto.json?term=ang&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1551 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:52 +0000] [21] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:52 +0000] "GET /select2/fields/auto.json?term=an&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1551 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:54 +0000] [23] [DEBUG] GET /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:54 +0000] "GET /select2/fields/auto.json?term=an&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 200 2156 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:55 +0000] [23] [DEBUG] GET /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:55 +0000] "GET /select2/fields/auto.json?term=ang&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 200 198 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:55 +0000] [24] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:55 +0000] "GET /select2/fields/auto.json?term=ange&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1552 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:16:55 +0000] [22] [DEBUG] GET /select2/fields/auto.json
Not Found: /select2/fields/auto.json
172.19.0.4 - - [22/Dec/2023:13:16:56 +0000] "GET /select2/fields/auto.json?term=angel&field_id=ImVkM2I5ZGU1LTRjNzEtNDAwOC05Zjk5LWQwMzkxNjFkZjU2YyI%3A1rGf6Q%3AouOxYP_I_sbR9i6nU1z0ga3vtGEjLXCcr9gLt--OedM HTTP/1.1" 404 1553 "https://app.domain.internal/object/add/b6102630-e5dc-40f9-be6e-f22b002905d0/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
[2023-12-22 13:17:14 +0000] [22] [DEBUG] GET /
Bug Description
Hi!
I get intermittent 'field_id not found' errors. On my local machine, doing a manage.py runserver, everything works fine. However, in my docker container it only works once every few requests.
If I start typing in my autocomplete field, I see ajax requests going to /select2/fields/auto.json?term=ange&field_id=IjVkOTJjOTE.. for example. If I just start typing something that is in the list, then most of the time it'll say 'the results could not be loaded', but every now and then upon typing, it'll output a response.
If I open up my browser's network inspect tool, I see most requests return a 404 'field_id not found', and some will return a 200 with the json. But all the requests are identical, except for the search term.
I don't understand why it's throwing these errors!
running python 3.11 and: Django==4.2.7 django-select2==8.1.2 gunicorn==21.2.0
These exact versions are the same in the docker image.
On my dev machine I run manage.py runserver. In the docker image I have a simple nginx config with gunicorn running. A single container, no balancing, no caching components, no caching configuration in django (so the default LocMemCache is used).
See this nginx output for example, you see a lot of 404's, with a few 200's in between:
p.s. I created a discussion as well, but that did not get any answers: https://github.com/codingjoe/django-select2/discussions/251
Steps to Reproduce
type stuff into the autocomplete field
Expected Behavior
I expect every request to /select2/fields/auto.json return a 200 instead of a 404.