firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.86k stars 893 forks source link

FR: Firebase Performance Web doesn't report traces in iOS Capacitor app (but works in Android Capacitor app) #4243

Open kirillgroshkov opened 3 years ago

kirillgroshkov commented 3 years ago

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

Steps to reproduce:

  1. Install a Hello World Capacitor app (https://capacitorjs.com/), add a Firebase SDK (using a bundler), config for a WebApp
  2. Do a firebase.performance().trace('myTrace').record(Date.now(), 100)
  3. See that in Safari Network tab it logs trace events (see screenshot further).
  4. Even after 24 hours, Firebase Performance Console doesn't show any Traces (and any other Events) from iOS. But works perfectly with Android.

image

Payload in this call ``` { "request_time_ms": "1609169136407", "client_info": { "client_type": 1, "js_client_info": {} }, "log_source": 462, "log_event": [ { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"bootstrapStarted\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":258000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"platformReady\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":287000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"bootstrapDone\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":565000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"appInitDone\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":565000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"IntroPage.ngOnInit\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":583000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"firstPageOpened\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":663000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"splashScreenRemoved\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":685000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"_wt_capacitor://localhost/intro\",\"is_auto\":true,\"client_start_time_us\":1609169130464000}}", "event_time_ms": "1609169131412" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-master.naturalcycles.com/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169130875000,\"time_to_response_completed_us\":66000}}", "event_time_ms": "1609169131413" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://www.googletagmanager.com/gtm.js\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169130877000,\"time_to_response_completed_us\":29999}}", "event_time_ms": "1609169131413" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-js.mixpanel.com/decide/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169130884000,\"time_to_response_completed_us\":36000}}", "event_time_ms": "1609169131413" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://sdk-cdn.optimove.net/webconfig/22931d6ebcd5134152d42c8bf624cc6cddf25ecad59894bfd9ddddf7f52aee51/NaturalCycles.1.0.0-stg.js\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169130887000,\"time_to_response_completed_us\":485000}}", "event_time_ms": "1609169131413" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-master.naturalcycles.com/api/v3/app/appInit\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169130916000,\"time_to_response_completed_us\":159000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-master.naturalcycles.com/api/v3/experiments/AB103\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131106000,\"time_to_response_completed_us\":56000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-js.mixpanel.com/track/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131128000,\"time_to_response_completed_us\":54000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-js.mixpanel.com/track/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131208000,\"time_to_response_completed_us\":44000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://api-js.mixpanel.com/track/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131218000,\"time_to_response_completed_us\":50000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://sdk-cdn.optimove.net/webconfig/prod/sdk-events.js\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131377000,\"time_to_response_completed_us\":4000}}", "event_time_ms": "1609169131414" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone\",\"is_auto\":false,\"client_start_time_us\":1609169130523000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:ZoneAwarePromise\",\"is_auto\":false,\"client_start_time_us\":1609169130523000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:util\",\"is_auto\":false,\"client_start_time_us\":1609169130524000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:timers\",\"is_auto\":false,\"client_start_time_us\":1609169130524000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:toString\",\"is_auto\":false,\"client_start_time_us\":1609169130524000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:legacy\",\"is_auto\":false,\"client_start_time_us\":1609169130524000,\"duration_us\":0}}", "event_time_ms": "1609169131415" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:EventTarget\",\"is_auto\":false,\"client_start_time_us\":1609169130525000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:blocking\",\"is_auto\":false,\"client_start_time_us\":1609169130525000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:on_property\",\"is_auto\":false,\"client_start_time_us\":1609169130526000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:geolocation\",\"is_auto\":false,\"client_start_time_us\":1609169130530000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:XHR\",\"is_auto\":false,\"client_start_time_us\":1609169130530000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"Zone:PromiseRejectionEvent\",\"is_auto\":false,\"client_start_time_us\":1609169130531000,\"duration_us\":0}}", "event_time_ms": "1609169131416" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://stream-696-stg.optimove.net/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131390000,\"time_to_response_completed_us\":151000}}", "event_time_ms": "1609169131557" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://stream-696-stg.optimove.net/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131390000,\"time_to_response_completed_us\":155000}}", "event_time_ms": "1609169131557" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://stream-696-stg.optimove.net/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131391000,\"time_to_response_completed_us\":155000}}", "event_time_ms": "1609169131557" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://realtime-696-stg.optimove.net/reportEvent\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131553000,\"time_to_response_completed_us\":36000}}", "event_time_ms": "1609169131602" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://realtime-696-stg.optimove.net/reportEvent\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131555000,\"time_to_response_completed_us\":38000}}", "event_time_ms": "1609169131603" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"network_request_metric\":{\"url\":\"https://o94439.ingest.sentry.io/api/5385981/store/\",\"http_method\":0,\"http_response_code\":200,\"client_start_time_us\":1609169131616000,\"time_to_response_completed_us\":390999}}", "event_time_ms": "1609169132017" }, { "source_extension_json_proto3": "{\"application_info\":{\"google_app_id\":\"1:712514701016:web:8b5e826255e345c6\",\"app_instance_id\":\"chciZivQcR6FlBZQ0xkVjc\",\"web_app_info\":{\"sdk_version\":\"0.4.5\",\"page_url\":\"capacitor://localhost/intro\",\"service_worker_status\":1,\"visibility_state\":1,\"effective_connection_type\":0},\"application_process_state\":0},\"trace_metric\":{\"name\":\"firstIdle\",\"is_auto\":false,\"client_start_time_us\":1609169130521000,\"duration_us\":5627000,\"custom_attributes\":{\"appVer\":\"4.0.8\",\"buildInfoVer\":\"20201228_1525\",\"cordova\":\"true\",\"platform\":\"IOS\"}}}", "event_time_ms": "1609169136152" } ] } ```

Response:

{
  "nextRequestWaitMillis": "10000",
  "logResponseDetails": [
    {
      "responseAction": "DELETE_REQUEST"
    }
  ]
}

When debugging the same app deployed to Netlify, it logs very similar payload (difference is that page_url is set to e.g https://myapp.netlify.app/home instead of capacitor://localhost/home), and exactly same response.

Can it be that Firebase Backend somehow silently rejects urls like capacitor://localhost/home? But, actually, the url is exactly the same when installed on Android, and there it works just fine.

Previously, before we upgraded Cordova to Capacitor, we had the same issue (worked just fine on Android, but not on iOS, since iOS 10.0).

I have studied the source code of @firebase/performance quite thoroughly over the last year, but cannot really find any clues of what can be wrong.

google-oss-bot commented 3 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

kirillgroshkov commented 3 years ago

I have an update!

If I modify the api_service.ts to replace the schema from capacitor to http - it starts to work (I see Traces reported in Firebase Console).

Code:

Api.prototype.getUrl = function () {
        console.log('!!!!!!!!!!!!!!!!!!!!!!! getUrl !!!!!!!!!!!!!!!')
        // Do not capture the string query part of url.
        // return this.windowLocation.href.split('?')[0];
        return this.windowLocation.href.split('?')[0].replace('capacitor', 'http');
    };

image

Will try it in Production in the next release (next month).

Can someone from Firebase approve/disprove this "workaround"?

visumickey commented 3 years ago

@kirillgroshkov Thanks a lot for digging deeper into the issue. Happy to see a suggested workaround.

The codepath that is used for the capacitor apps (both iOS and Android as a platform) should be similar and so it is surprising that this worked for Android platform and not for iOS. Were you using the same appId for iOS and Android platform? This could help us to understand the difference between the performance event processed for iOS and Android and get to the bottom of the issue.

Regarding the suggested workaround: Ideally we would not want to tamper with the URL that is used for measuring the performance. So, we will take this as an issue to see how we can allow the processing of non-http URLs of the window location.

visumickey commented 3 years ago

This issue is internally tracked at b/176498312

kirillgroshkov commented 3 years ago

Were you using the same appId for iOS and Android platform?

Yes, same appId, same firebase config, no intentional differences.

Regarding the suggested workaround: Ideally we would not want to tamper with the URL that is used for measuring the performance. So, we will take this as an issue to see how we can allow the processing of non-http URLs of the window location.

It could be that Capacitor on Android uses some schema other than capacitor://. I'll check it whenever I have a chance. But that would explain it, if true.

visumickey commented 3 years ago

Apparently, it is Fireperf BE that blocks all the non-http/https URLs. This is intentional and we are looking to see if we can enable processing of non-http/s URLs. Will move this as a feature request and see how early can we have this opened up. Thanks for reporting this issue.

kirillgroshkov commented 3 years ago

My colleague @duryno just reported that in Capacitor-Android the url schema is http://, which explains why it was always working.

kirillgroshkov commented 3 years ago

Apparently, it is Fireperf BE that blocks all the non-http/https URLs. This is intentional and we are looking to see if we can enable processing of non-http/s URLs. Will move this as a feature request and see how early can we have this opened up. Thanks for reporting this issue.

Ok, good to know, thanks.

What was the most unexpected during my 6+ month investigation of this issue is that Firebase BE silently swallowed these errors, as opposed to returning some http error.

All troubleshooting docs of Firebase Perf currently only help you debug that your http requests are going through and reaching Firebase BE. But nothing suggests that they can be silently skipped like they do.

hoyangtsai commented 1 year ago

Facing the same issue in chrome extension popup. The url starts with chrome-extension://.

yogo10803 commented 2 weeks ago

I'm currently developing with Ionic Vue and Capacitor. On the iOS side, I’m using firebase-ios-sdk (v10.25.0) in Xcode and have enabled FirebasePerformance. It has been working for a while, and I can see auto-collected performance data in the Firebase console. Now, I’d like to add custom traces. I tried using @capacitor-firebase/performance (v6.1.0), but whenever I call FirebasePerformance.startTrace(), the app crashes with the message, "The default Firebase app has not yet been configured. Add FirebaseApp.configure() to your application initialization."

I also tried using the 'firebase' (v10.14.1) package on the backend. There was no error, and I could see API logs following the official Firebase debugging method. However, the API response returned: { "nextRequestWaitMillis": "10000", "logResponseDetails": [ { "responseAction": "DELETE_REQUEST" } ] }

I've been stuck on this issue for several days. Does anyone know what I might be doing wrong, or is it currently impossible to record custom traces in Firebase Performance Monitoring with Capacitor?