olenakozdoba / hackathon-project

This is the repository created to store and share codebase for a hackathon project.
0 stars 1 forks source link

Firebase Fix to "Firebase is not defined" #9

Open TomKwee opened 7 years ago

TomKwee commented 7 years ago

I got a good chance to investigate this problem this week. The problem is due to the Firebase upgrade to 3.x. There is documentation at https://firebase.google.com/support/guides/firebase-web. The point is that code of new Firebase is outdated, simply use firebase.database().ref(). I only have to change map.js to fix that.

The strange thing is that I did not get the same error as yours until I changed the code referenced to www.gstatic.com/firebasejs/3.5.1. So my first instinct is wrong, about not having the proper reference to that link. I am using a different way to add/commit code changes. I used the web Github, again, and this time, I commit changes from the <>Code tab. I uploaded all 5 files for your convenience.

I was hoping to make this code fix earlier. Eager to see the change now :-)

olenakozdoba commented 7 years ago

Tommy, I switched to the Tommy_branch and applied the fix for Firebase (firebase.database().ref() instead of new Firebase("..."))=> the JS error is gone, but Reserve/Release functionality isn't working. No errors, just after page refresh it's not changing the pin. Is this working for you?

TomKwee commented 7 years ago

It is working for me. I tested the app on Github, https://easychargeapp.firebaseapp.com, and it has the same problem that you mentioned. The app simply could not change the "status" field onto the Firebase. My Chrome dev tool reports error of "Synchronous XMLHttpRequest on the main thread is deprecated..." on code addressRef.update(). However I do not get that error on my local environment. So it's a puzzlement.

I'll look into it further. I think it was working before even for the app on Github, right? It seems the problem is related to Firebase and my local environment is different but I do not know what that can be for now.