You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Saw a few errors on one of the instances I host. Seems like invalid data was being sent to a sensor, and farmOS code doesn't check for that. These are the two specific errors I saw, one in the farm_sensor module and one in the data_stream module:
TypeError: Drupal\farm_sensor\Controller\SensorDataController::getUniqueNamedValues(): Argument #1 ($data) must be of type array, null given, called in /opt/drupal/web/profiles/farm/modules/asset/sensor/src/Controller/SensorDataController.php on line 138 in Drupal\farm_sensor\Controller\SensorDataController->getUniqueNamedValues() (line 186 of /opt/drupal/web/profiles/farm/modules/asset/sensor/src/Controller/SensorDataController.php)
TypeError: Drupal\data_stream\Plugin\DataStream\DataStreamType\Basic::storageSave(): Argument #2 ($data) must be of type array, null given, called in /opt/drupal/web/profiles/farm/modules/core/data_stream/src/Plugin/DataStream/DataStreamType/Basic.php on line 320 in Drupal\data_stream\Plugin\DataStream\DataStreamType\Basic->storageSave() (line 422 of /opt/drupal/web/profiles/farm/modules/core/data_stream/src/Plugin/DataStream/DataStreamType/Basic.php)
To Reproduce
TBD
Expected behavior
farmOS should return a 422 Unprocessable Content response.
The text was updated successfully, but these errors were encountered:
// Bail if data is invalid.
if (is_null($data)) {
throw new UnprocessableEntityHttpException();
}
But this might not be the only place we need to address this. IIRC there are endpoints for posting directly to data streams too, which are different than this one, which is an endpoint for the sensor asset itself.
I have not tested any of this myself, so it's just conjecture. We should also add automated test(s).
Describe the bug
Saw a few errors on one of the instances I host. Seems like invalid data was being sent to a sensor, and farmOS code doesn't check for that. These are the two specific errors I saw, one in the
farm_sensor
module and one in thedata_stream
module:To Reproduce
TBD
Expected behavior
farmOS should return a
422 Unprocessable Content
response.The text was updated successfully, but these errors were encountered: