I can't believe I haven't tested this yet, but it seems like recording lengths at and above 45 seconds are not posting to app.BirdWeather.com properly. Update: 42 seconds and less are POSTing without issue 👍
This error appears right after writing to the database when detections above the minimum confidence occur -- it appears the response from the POST from your nginx
server is that the "Request Entity" size is too large.
Soundscape POST Response Status - 413
Exception in thread Thread-11:
Traceback (most recent call last):
File "/home/pi/BirdNET-Pi/birdnet/lib/python3.9/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
File "/usr/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/BirdNET-Pi/./scripts/server.py", line 382, in handle_client
sdata = response.json()
File "/home/pi/BirdNET-Pi/birdnet/lib/python3.9/site-packages/requests/models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
: 0
I'm thinking there is a way to handle this somewhere -- perhaps on the server side in nginx
's allowable header size limit, or in the code itself, chopping the audio and spectrograms into smaller POSTs??
Anywho, let me know what else I can provide for you, or if this needs to be a hard limit when having BirdWeather enabled.