szimek / sharedrop

Easy P2P file transfer powered by WebRTC - inspired by Apple AirDrop
https://www.sharedrop.io
MIT License
9.35k stars 682 forks source link

Sharedrop keeps loading after deployment #155

Open kenjibailly opened 1 year ago

kenjibailly commented 1 year ago

I think I might have done something wrong, as I'm not familiar, with the firebase db. I created a realtime db, copied the link shown under the "Data" tab and put it in the FIREBASE_URL env. I changed the rules to this:

{
  "rules": {
    ".read": true,
    ".write": true
  }
}
[Sign up](https://www.firebase.com/) for a Firebase account and create a database.
Go to "Security Rules" tab, click "Load Rules" button and select firebase_rules.json file.
Take note of your database URL and its secret, which can be found in "Secrets" tab.

I think some things might have changed on the firebase side as I couldn't find "Load Rules", just a Rules tab. The "Secrets" tab I couldn't find that either. I guess it's all within the Rules editor now?

I put nothing in the FIREBASE_SECRET env (for testing). Unfortunately I don't see any logs of not being able to connect to a firebase db. So I'm not sure if it connects or not.

Can someone tell me what I'm doing wrong?

https://sharedrop.mindglowing.art/

gabbelitoV2 commented 1 year ago

the same thing happens to me

gabbelitoV2 commented 1 year ago

how can we solve it

szimek commented 1 year ago

You can get FIREBASE_SECRET when you go to Project settings -> Service accounts -> Database secrets.

However, I do not know if these secrets are created for new Firebase projects, as they are marked as deprecated. FIREBASE_SECRET is only used to generate authentication token in server.js file. You might be able to update the code to use a non-deprecated solution to generate them, or even skip this part completely and have unauthenticated users.

kenjibailly commented 1 year ago

You can get FIREBASE_SECRET when you go to Project settings -> Service accounts -> Database secrets.

However, I do not know if these secrets are created for new Firebase projects, as they are marked as deprecated. FIREBASE_SECRET is only used to generate authentication token in server.js file. You might be able to update the code to use a non-deprecated solution to generate them, or even skip this part completely and have unauthenticated users.

I found the secret and added the secret to the .env file, however it still keeps loading...

szimek commented 1 year ago

@kenjibailly The error handling could be done better, but the error I'm getting on your page is the following:

"FIREBASE FATAL ERROR: Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com "

Yours is: "https://sharedrop-mindglowingart-default-rtdb.europe-west1.firebasedatabase.app/"

kenjibailly commented 1 year ago

I tried to find that "firebasio" url, but couldn't find it. So I just tried to change FIREBASE_URL with these: https://sharedrop-mindglowingart.firebaseio.com/ https://sharedrop-mindglowingart-default-rtdb.europe-west1.firebaseio.com/

But they also keep loading. All I can find is https://sharedrop-mindglowingart-default-rtdb.europe-west1.firebasedatabase.app/

I'm not entirely sure how to proceed from here, thanks for answering though!

szimek commented 1 year ago

For Sharedrop the FIREBASE_URL is https://sharedrop.firebaseio.com. This is the URL that I see in Firebase console when I go to "Realtime Database" and "Data":

sharedrop-firebase-url

If you deploy a new version with a correct FIREBASE_URL and it still doesn't work, let me know and I can see if I can find what's wrong. This would help me to update the docs to make it easier for others to deploy it themselves.

kenjibailly commented 1 year ago

For Sharedrop the FIREBASE_URL is https://sharedrop.firebaseio.com. This is the URL that I see in Firebase console when I go to "Realtime Database" and "Data":

sharedrop-firebase-url

If you deploy a new version with a correct FIREBASE_URL and it still doesn't work, let me know and I can see if I can find what's wrong. This would help me to update the docs to make it easier for others to deploy it themselves.

Well that's the initial url I used, please have a look at my screenshot. image

szimek commented 1 year ago

Got it. Most likely the URL pattern has changed, but the ~10 year old version of the Firebase library used in Sharedrop does not support the new URL pattern :/ I can see if I can update the library, but it might be non-trivial, as a lot has changed :/

kenjibailly commented 1 year ago

Got it. Most likely the URL pattern has changed, but the ~10 year old version of the Firebase library used in Sharedrop does not support the new URL pattern :/ I can see if I can update the library, but it might be non-trivial, as a lot has changed :/

Okay thank you for looking into it, please let us know if you got an update regarding this!

gabbelitoV2 commented 1 year ago

I changed the json file and removed all . and $ and stuff like that image firebase.txt

gabbelitoV2 commented 1 year ago

can it be a solution? because then you can load that file

githubxdax commented 2 months ago

Has someone found a workaround to the new URL format of Firebase databases? Since every newly created database is not supported by the old library anymore.