Skip to content

README Properties Service key retrieval error #161

Description

@gskll

Is your feature request related to a problem?

In README.md#configuration-template when talking about using Properties Service to retrieve the configuration data, specifically the private_key.

If the key is set programatically through PropertiesService.getScriptProperties().setProperty() there is no issue.
But if the key is set manually through the script settings then it gives an error on retrieval.

This is related to this issue where newline characters aren't correctly converted and has to be done manually upon retrieval.

For example

 // if script property set manually
 const props = PropertiesService.getScriptProperties();
  const [email, key, projectId] = [
    props.getProperty("client_email"),
    props.getProperty("private_key").replace(/\\n/g, "\n"), // Solution from issue linked above
    props.getProperty("project_id"),
  ];
  const firestore = FirestoreApp.getFirestore(email, key, projectId);

Describe the solution you'd like

To clarify this in the documentation to avoid confusion when setting the private_key in this way.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions