firebase-js-sdk
firebase-js-sdk copied to clipboard
[SMART TV] Cant get ETag from headers (smart tv browser security)
Hi! 👋
Firstly, thanks for your work on this project! 🙂
I am a developer of smart TVs. Some new TVs, due to the fact that supposedly incorrect security settings are written inside them, do not give an ETag response from the headers. As a solution - I'm just using a random structure in Date.now() for now. Please change the code so that if Etag is missing, you can work with the library normally.
Here is the diff that solved my problem:
diff --git a/node_modules/@firebase/remote-config/dist/esm/index.esm.js b/node_modules/@firebase/remote-config/dist/esm/index.esm.js
index 7554cb1..271686c 100644
--- a/node_modules/@firebase/remote-config/dist/esm/index.esm.js
+++ b/node_modules/@firebase/remote-config/dist/esm/index.esm.js
@@ -644,6 +644,10 @@ var RestClient = /** @class */ (function () {
case 6:
status = response.status;
responseEtag = response.headers.get('ETag') || undefined;
+ if (!responseEtag) {
+ responseEtag = Date.now().toString();
+ console.warn('[FIREBASE] Cant get ETag from headers. The Date.now() method is used to make request unique.')
+ }
if (!(response.status === 200)) return [3 /*break*/, 11];
responseBody = void 0;
_e.label = 7;
diff --git a/node_modules/@firebase/remote-config/dist/esm/index.esm2017.js b/node_modules/@firebase/remote-config/dist/esm/index.esm2017.js
index 129a419..99dc292 100644
--- a/node_modules/@firebase/remote-config/dist/esm/index.esm2017.js
+++ b/node_modules/@firebase/remote-config/dist/esm/index.esm2017.js
@@ -591,7 +591,11 @@ class RestClient {
}
let status = response.status;
// Normalizes nullable header to optional.
- const responseEtag = response.headers.get('ETag') || undefined;
+ let responseEtag = response.headers.get('ETag') || undefined;
+ if (!responseEtag) {
+ responseEtag = Date.now().toString();
+ console.warn('[FIREBASE] Cant get ETag from headers. The Date.now() method is used to make request unique.')
+ }
let config;
let state;
// JSON parsing throws SyntaxError if the response body isn't a JSON string.
diff --git a/node_modules/@firebase/remote-config/dist/index.cjs.js b/node_modules/@firebase/remote-config/dist/index.cjs.js
index 15fbc3b..11ac3dc 100644
--- a/node_modules/@firebase/remote-config/dist/index.cjs.js
+++ b/node_modules/@firebase/remote-config/dist/index.cjs.js
@@ -648,6 +648,10 @@ var RestClient = /** @class */ (function () {
case 6:
status = response.status;
responseEtag = response.headers.get('ETag') || undefined;
+ if (!responseEtag) {
+ responseEtag = Date.now().toString();
+ console.warn('[FIREBASE] Cant get ETag from headers. The Date.now() method is used to make request unique.')
+ }
if (!(response.status === 200)) return [3 /*break*/, 11];
responseBody = void 0;
_e.label = 7;
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @ValeraGin, thanks for the report. You can actually create a pull requests for this one. I'll notify an engineer to have this checked. Thank you for your contribution!
Hey @ValeraGin. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Since there haven't been any recent updates here, I am going to close this issue.
@ValeraGin if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.