diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/gettingstarted_web/app.py b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/gettingstarted_web/app.py index 664540b1..b92e6535 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/gettingstarted_web/app.py +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/gettingstarted_web/app.py @@ -103,6 +103,10 @@ def build(self, resource_key, logger): pipeline_settings = { "resource_key": resource_key, "javascript_builder_settings": javascript_builder_settings, + # Set to True so a device-detection failure degrades gracefully instead of + # returning a 500 for every request. Use False while developing to surface + # mistakes loudly. Errors are still recorded on flowdata.errors / the logger. + "suppress_process_exceptions": True, } # If a cloud endpoint is set in the environment, point the pipeline at it. cloud_endpoint = ExampleUtils.get_cloud_endpoint() diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/useragentclienthints_web/app.py b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/useragentclienthints_web/app.py index ac8c2373..d594153c 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/useragentclienthints_web/app.py +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/cloud/useragentclienthints_web/app.py @@ -64,6 +64,10 @@ def build(self, resource_key, logger): # header use the SetHeaderBrowserAccept-CH property. pipeline_settings = { "resource_key": resource_key, + # Set to True so a device-detection failure degrades gracefully instead of + # returning a 500 for every request. Use False while developing to surface + # mistakes loudly. Errors are still recorded on flowdata.errors / the logger. + "suppress_process_exceptions": True, } # If a cloud endpoint is set in the environment, point the pipeline at it. cloud_endpoint = ExampleUtils.get_cloud_endpoint() diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/app.py b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/app.py index 7b8fe826..d5a4f6a2 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/app.py +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/app.py @@ -91,6 +91,10 @@ class GettingStartedWeb(): def build(self, config, logger): # Here we add some callback settings for the page to make a request with extra evidence from the client side, in this case the Flask /json route we will make below + # 'suppress_process_exceptions' is set to True in config.json + # (PipelineOptions.BuildParameters) so a device-detection failure degrades + # gracefully instead of returning a 500 for every request. Use False while + # developing to surface mistakes loudly. GettingStartedWeb.pipeline = PipelineBuilder().add_logger(logger).build_from_configuration(config) return self diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/config.json b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/config.json index d5cf4984..b355a2e4 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/config.json +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/gettingstarted_web/config.json @@ -42,6 +42,9 @@ "header_blacklist": [] } } - ] + ], + "BuildParameters": { + "suppress_process_exceptions": true + } } } \ No newline at end of file diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/app.py b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/app.py index fe00208c..9c3630cf 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/app.py +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/app.py @@ -65,6 +65,10 @@ class UserAgentClientHintsWeb(): app = Flask(__name__) def build(self, config, logger): + # 'suppress_process_exceptions' is set to True in config.json + # (PipelineOptions.BuildParameters) so a device-detection failure degrades + # gracefully instead of returning a 500 for every request. Use False while + # developing to surface mistakes loudly. UserAgentClientHintsWeb.pipeline = PipelineBuilder().add_logger(logger).build_from_configuration(config) return self diff --git a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/config.json b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/config.json index d5cf4984..b355a2e4 100644 --- a/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/config.json +++ b/fiftyone_devicedetection_examples/src/fiftyone_devicedetection_examples/onpremise/useragentclienthints_web/config.json @@ -42,6 +42,9 @@ "header_blacklist": [] } } - ] + ], + "BuildParameters": { + "suppress_process_exceptions": true + } } } \ No newline at end of file