grahamearley / FirestoreGoogleAppsScript

A Google Apps Script library for accessing Google Cloud Firestore.
http://grahamearley.website/blog/2017/10/18/firestore-in-google-apps-script.html
MIT License
648 stars 109 forks source link

Google Apps Script: Missing ; before statement. #104

Closed nathgilson closed 4 years ago

nathgilson commented 4 years ago

Expected Behavior

Extension opens as expected

Actual Results

Extension doesnt appear in the menu, and error in the console: "Google Apps Script: Missing ; before statement."

Library Version:

33 with Rhino ("DEPRECATED_ES5")

LaughDonor commented 4 years ago

As stated in the README:

Scripts utilizing the old Rhino runtime must use v26.

nathgilson commented 4 years ago

@LaughDonor it works but now I keep getting the "Google Apps Script: You do not have permission to call UrlFetchApp.fetch" error

LaughDonor commented 4 years ago

@nathgilson Are you running Firestore functions in a Trigger?

nathgilson commented 4 years ago

No I don't

LaughDonor commented 4 years ago

What did you mean by "Extension doesnt appear in the menu"? Which menu should it be appearing in?

nathgilson commented 4 years ago

My extension doesn't appear in the Add-on menu. Instead I get this error (see screenshot):

Screenshot 2020-09-11 at 18 23 03
nathgilson commented 4 years ago

I found a patch: you have to call firestore as a funstion: const firestore = () => FirestoreApp.getFirestore(client_email, private_key, project_id) const userDoc = firestore().getDocument(user) ...

instead of: const firestore = FirestoreApp.getFirestore(client_email, private_key, project_id) const userDoc = firestore.getDocument(user) ...

nathgilson commented 4 years ago

i know i was talking about my own add-on of course

LaughDonor commented 4 years ago

You still need to execute your function at least once within Google Apps Script so that you can authorize Google to utilize the necessary permissions. https://developers.google.com/apps-script/guides/services/authorization