Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIREBASE WARNING: wss:// URL used, but browser isn't known to support websockets. #1487

Closed
arnav-kr opened this issue Nov 5, 2021 · 32 comments · Fixed by firebase/firebase-js-sdk#5708
Assignees

Comments

@arnav-kr
Copy link

arnav-kr commented Nov 5, 2021

constantly getting this message in the console and also unable to read and write to the database, I have another project running with the same version but that one is working correctly

logs:
image

dependencies:
image

code:
image

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@raulnetspot
Copy link

I have the same problem, but using Typescript:

import * as functions from 'firebase-functions';
import {initializeApp, cert, getApp} from 'firebase-admin/app';
import {getAuth} from 'firebase-admin/auth';
import {getDatabase, getDatabaseWithUrl} from 'firebase-admin/database';
import {getStorage} from 'firebase-admin/storage';
import {getMessaging} from 'firebase-admin/messaging';

const config = functions.config().env;
const serviceAccount =
  config.production === 'true'
    ? require('../service-credential-prod.json')
    : require('../service-credential-staged.json');

initializeApp({
  credential: cert(serviceAccount, ),
  databaseURL: config.dbUrl,
});

export const app = getApp();
export const auth = getAuth();
export const db = getDatabase();
export const medicalDb = getDatabaseWithUrl(config.dbMedicalUrl);
export const storage = getStorage();
export const messaging = getMessaging();
"engines": {
    "node": "14"
  },
  "main": "build/index.js",
  "dependencies": {
    "ajv": "^8.6.3",
    "date-fns": "^2.25.0",
    "firebase-admin": "^10.0.0",
    "firebase-functions": "^3.16.0"
  },
  "devDependencies": {
    "firebase-functions-test": "^0.3.3",
    "firebase-tools": "^9.22.0",
    "typescript": "^4.4.4"
  },

@lahirumaramba
Copy link
Member

lahirumaramba commented Nov 5, 2021

Hi @arnav-kr, Thank you for reporting this issue!

@jsdt I can reproduce the issue with the following dependencies.

└─┬ firebase-admin@10.0.0
  ├── @firebase/database-compat@0.1.3
  ├── @firebase/database-types@0.7.3
  ├── @google-cloud/firestore@4.15.1
  ├── @google-cloud/storage@5.15.5
  ├── @types/node@16.11.6
  ├── dicer@0.3.0
  ├── jsonwebtoken@8.5.1
  ├── jwks-rsa@2.0.5
  └── node-forge@0.10.0

Seems to be working fine with @firebase/database-compat@0.1.2 and firebase-admin@10.0.0.

Any thoughts on what could be wrong?

@lpellegr
Copy link

lpellegr commented Nov 5, 2021

Some functions with the warning mentioned in this issue time out. Is this also your case?

@jcurlier
Copy link

jcurlier commented Nov 5, 2021

Same issue here +1

started last night, first error 2021-11-04 19:09:57

Seems to be working also with @firebase/database-compat@0.1.2 and firebase-admin@10.0.0.

@acoyfellow
Copy link

acoyfellow commented Nov 5, 2021

+1 same issue. i had to revert cloud run to an older revision to get it working

And, using that same exact codebase on a new deploy (same cloud run environment)- i see this error as well.

...
"engines": {
    "node": "14.16.0"
},
"firebase-admin": "9.12.0"
...

@amitsingh-007
Copy link

I also faced the same issue with firebase-admin version 9.12.0. Reverted to 9.11.0 and it works fine for now.

@lahirumaramba
Copy link
Member

lahirumaramba commented Nov 5, 2021

Thank you for your patience! Our team has identified the root cause and currently working on a fix.
In the meantime if you are on the latest Admin SDK version, you can pin @firebase/database-compat to version 0.1.2 in your package.json file as a temporary fix.

  "dependencies": {
    "@firebase/database-compat": "0.1.2"
  }

We will update here as soon as a fix is ready.

@ayyysh04
Copy link

ayyysh04 commented Nov 6, 2021

I am getting the same error/warning when trying to change/access something in realtime database,I tried the above solution but they didn't work.
could anyone see whats wrong in my code:
https://stackoverflow.com/questions/69853038/firebase-function-with-realtime-database-error

@ayyysh04
Copy link

ayyysh04 commented Nov 6, 2021

Thank you for your patience! Our team has identified the root cause and currently working on a fix. In the meantime if you are on the latest Admin SDK version, you can pin @firebase/database-compat to version 0.1.2 in your package.json file as a temporary fix.

  "dependencies": {
    "@firebase/database-compat": "0.1.2"
  }

We will update here as soon as a fix is ready.

I tried using this fix but it is still giving me the same warning/error.
If possible check out my same question on stackoverflow:https://stackoverflow.com/questions/69853038/firebase-function-with-realtime-database-error

@lpellegr
Copy link

lpellegr commented Nov 6, 2021

To force pin a specific version of @firebase/database-compat, I had to use the resolutions field of package.json:

"resolutions": {
    "@firebase/database-compat": "0.1.2"
},

@ayyysh04
Copy link

ayyysh04 commented Nov 7, 2021

To force pin a specific version of @firebase/database-compat, I had to use the resolutions field of package.json:

"resolutions": {
    "@firebase/database-compat": "0.1.2"
},

still getting the same warning/error

@acoyfellow
Copy link

Thank you for your patience! Our team has identified the root cause and currently working on a fix. In the meantime if you are on the latest Admin SDK version, you can pin @firebase/database-compat to version 0.1.2 in your package.json file as a temporary fix.

  "dependencies": {
    "@firebase/database-compat": "0.1.2"
  }

We will update here as soon as a fix is ready.

This isn't working for me - even if it's added to package.json resolutions

@lpellegr
Copy link

lpellegr commented Nov 7, 2021

@ayyysh04 @acoyfellow Did you rebuild your package-lock.json or yarn.lock after updating the package.json file?

@ayyysh04
Copy link

ayyysh04 commented Nov 7, 2021

@ayyysh04 @acoyfellow Did you rebuild your package-lock.json or yarn.lock after updating the package.json file?

no,i only edited the package.json but didn't rebuild the package-lock.json.
How can i rebuild the package-lock.json ?

@lpellegr
Copy link

lpellegr commented Nov 7, 2021

A simple way is to delete node_modules/ and package-lock.json, and then run npm install.

@acoyfellow
Copy link

Yes, I did.

I'm only seeing this in a Cloud Run environment. I've been unable to replicate in my local/dev environment.

@ayyysh04
Copy link

ayyysh04 commented Nov 7, 2021

A simple way is to delete node_modules/ and package-lock.json, and then run npm install.

thanks it worked ,but for rebuilding the package lock file i have to use npm install --package-lock-only

@lounerios
Copy link

lounerios commented Nov 8, 2021

I also faced the problem with "@firebase/database-compat": "0.1.2" and firebase-admin@10.0.0

@JCsplash
Copy link

JCsplash commented Nov 8, 2021

I'm using "firebase-admin": "9.7.0" and am also facing this issue.

This seems to have suddenly started happening a couple days ago because it didn't happen last week. I didn't change / update any code and this bug started to happen. Is this the experience others have had too?

@MarianBe
Copy link

MarianBe commented Nov 8, 2021

Same issues here, with runtime nodejs10 none of the combinations worked for me

"firebase-admin": "10.0.0",
"@firebase/database-compat": "0.1.2"

@lounerios
Copy link

Same issues here, with runtime nodejs10 none of the combinations worked for me

"firebase-admin": "10.0.0",
"@firebase/database-compat": "0.1.2"

I found the solution by using the resolutions for the database-compat and using yarn instead of npm.

@MarianBe
Copy link

MarianBe commented Nov 8, 2021

Found a solution, downgrading to
firebase-admin@9.11.0 worked for me

@acoyfellow
Copy link

Found a solution, downgrading to firebase-admin@9.11.0 worked for me

This worked for me as well.

@JCsplash
Copy link

JCsplash commented Nov 8, 2021

@Feiyang1 why did you close this issue? Is this fixed now? I've just tried and it still doesn't seem to work.

@JCsplash
Copy link

JCsplash commented Nov 8, 2021

Found a solution, downgrading to firebase-admin@9.11.0 worked for me

I've upgraded from firebase-admin@9.7.0 to firebase-admin@9.11.0 and did not have success :(

@lahirumaramba
Copy link
Member

This issue is now fixed in @firebase/database-compat@0.1.4. You might have to clean your package-lock files and run npm install to get the latest version of the database-compat dependency. Thank you.

@robertedjones
Copy link

Do we still need to add database-compat as a dependency and in resollutions?

@james-ingold
Copy link

Do we still need to add database-compat as a dependency and in resollutions?

No, you should be able to npm install with latest firebase deps

    "firebase": "^9.4.0",
    "firebase-admin": "^10.0.0",

@larssn
Copy link

larssn commented Nov 9, 2021

I can confirm that using the latest dependencies fixes the problem.

@JCsplash
Copy link

JCsplash commented Nov 10, 2021

Yesterday afternoon my functions were still throwing errors, but in the evening - without upgrading any packages or doing npm install - suddenly the functions started to work again.

It seems like the fix was purely on firebase's end and does not require any updates. Can someone confirm this is the case?

@Feiyang1 @jsdt

@lahirumaramba
Copy link
Member

Yesterday afternoon my functions were still throwing errors, but in the evening - without upgrading any packages or doing npm install - suddenly the functions started to work again.

It seems like the fix was purely on firebase's end and does not require any updates. Can someone confirm this is the case?

@Feiyang1 @jsdt

@JCsplash this is interesting. Once the functions are deployed it should not pull dependencies unless the function is re-created or updated. Do you by any chance have a mechanism to update the functions in your setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.