Edit Access Required? Using FirestoreGoogleAppsScript in a GAS Library.
See original GitHub issueMinimal Code to Reproduce the Problem
const firestore = FirestoreApp.getFirestore(email, key, projectId);
Explain the Problem in Detail
Hi, this library is great! Thank you for making it!
I wrote a bunch of wrapper functions using it and saved the file as a Google Apps Script Library in of itself.
I can invoke my library - which invokes FirestoreGoogleAppsScript - from my Owner account with no problem.
I’ve given other users View access to my library so that they can invoke its functions on their own.
However, when they try to do so, they get an error:
SyntaxError: Unexpected token < in JSON at position 0
Looking at the logs in the Executions Dashboard shows a more detailed stack trace:
SyntaxError: Unexpected token < in JSON at position 0
at method_(Request:49:34)
at post(Request:95:21)
at callback(FirestoreRead:115:41)
at Execute(Query:241:21)
When I grant the user edit access to my library (the one that invokes FirestoreGoogleAppsScript), the error disappears. I was wondering what would cause Edit access to be required. Thanks
Other Comments
Library Version:
33
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
Firestore for Google Apps Scripts - GitHub
A Google Apps Script library for accessing Google Cloud Firestore. This library allows a user (or service account) to authenticate with Firestore and...
Read more >Libraries | Apps Script - Google Developers
Gain access to a library; Add a library to your script project; Use a library ... At the left of the Apps Script...
Read more >Google Apps Script Library Database
Make tweaks and share with others to edit at the same time. NO THANKSUSE THE APP.
Read more >GAS: How to allow other people to use your library without ...
I just want to use the library in different google drives, without having to share the code, but just the library/project key. I...
Read more >How to Use Service Accounts and OAuth2 in Google Apps Script
Example One: Accessing Firestore With the FirestoreGoogleAppsScript Library. What Is Firestore? If you are already familiar with Firestore, you ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

So I have my own copy of this library (use Project ID
1yIYw-qTL5UWCYae8_Qe9NAIxbkNrW289HA0kcWFQNTxlb9WDeVfm2Jcq) which I have added some debug statements for you around the problem statement, including aconsole.logof the actual response text from FireStore that you should check.Please report back with your findings!
I’m experiencing a very similar error.
The library seems to work fine on my account, but this error sometimes occurs when other users try my add-on.
I’m pretty confident it’s not an issue with the format of the credentials, but I’ll continue to look into it.