Closed vitata78 closed 4 years ago
Is your code running in V8, or Rhino runtime?
the issue above appeared in V8.
when I switch back to Rhino - the error is the following:
Missing ; before statement. (line 12, file "Auth", project "FirestoreApp")
I wasn't able to reproduce the issue, did you follow the format of the key
properly? The README templates this out appropriately.
here is the code I use (Rhino ver)
getFirestore() func works well, no errors. when tried to remove few chars from the key - got another error saying the key is invalid, so the key works and accepted.
the service account is Cloud Database Owner
Please advise..
I wasn't able to reproduce the issue, did you follow the format of the
key
properly? The README templates this out appropriately.
OK, sorry for this - figured out - the key was formatted not properly - you were right! everything works well now!
Hey @vitata78 , what was your key formatting issue? I'm running into a similar problem -- albeit, not while using Firestore -- and can't figure out what's wrong with my key. I got this error instead of the invalid key one and assumed the key was set up, but it sounds like it might still not be?
Edit:
Ye who find this thread, as of this posting time, the correct key format for Utilities. computeRsaSha256Signature()
is to remove all newlines and whitespace from the private keyPKCS#8 format.
By default, the PEM format will have:
-----BEGIN RSA KEY-----
line 1 of 64 chars
line 2 of 64 chars
....
line 25 of 64 chars
line 26 of 24 chars
-----END RSA KEY-----
The newlines, and potentially whitespaces, between each line of the private key need to be removed in order to make GAS happy:
-----BEGIN RSA KEY-----
line 1 of 64 charsline 2 of 64 chars....line 25 of 64 charsline 26 of 24 chars
-----END RSA KEY-----
Minimal code to reproduce the problem
Expected Behavior
Actual Results
on the const allDocuments = firestore.getDocuments("paragraphs"); step
Library Version: