Giter VIP home page Giter VIP logo

heroku-google-application-credentials-buildpack's Introduction

heroku-google-application-credentials-buildpack

Generates a Google credential file based on Heroku Config Vars.

This is useful when using a package such as @google-cloud/storage which loads credentials from a file instead of an environmental variable.

Usage

  1. Create Config Vars key GOOGLE_CREDENTIALS and paste the content of service account credential JSON file as is.
  2. Create a key under Config Vars GOOGLE_APPLICATION_CREDENTIALS and set a value as google-credentials.json.

The script with generate a file called google-credentials.json which holds the key from the step #1 above.

heroku-google-application-credentials-buildpack's People

Contributors

dmathieu avatar elishaterada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

heroku-google-application-credentials-buildpack's Issues

No longer works on the heroku-16 stack

A few days ago, #1 was merged, and the compile script uses the syntax ${GOOGLE_CREDENTIALS@Q} which was introduced in bash 4.4.

The heroku-16 stack has bash 4.3.48, so this buildpack no longer works there (but on heroku-18 it works fine).

Empty google-credentials.json after build

During compile phase, when I read google-credentials.json, the file is empty. After further reading I found out that google-credential.sh only contain echo > /app/google-credentials.json.

Referencing Build Pack API Documentation, turns out build pack should have read env value from $ENV_DIR instead from env directly.

#3

File google-credentials.json is not a valid json file

Hi,
I have a add the two variables GOOGLE_CREDENTIALS and GOOGLE_APPLICATION_CREDENTIALS.

I am getting this error:

google.auth.exceptions.DefaultCredentialsError: ('File google-credentials.json is not a valid json file.', JSONDecodeError('Expecting value: line 2 column 1 (char 1)',))

my json file looks like this:

{ "type": "service_account", "project_id": "324", "private_key_id": "4edf183b0221", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhSkAgEAAoIBAQC3z3HICSRreEIv\nV3v0O4j/N+vjhmLrSpAXaeLHAkFk/RsYmzR\neHiRSTtP0YFfxAXzLsDAN82z5cWY\ny4p0QuNro8685K73P\n-----END PRIVATE KEY-----\n", "client_email": "starting.com", "client_id": "114229", "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token", "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/sa.gserviceaccount.com" }

Thank you

I'm getting "ERROR SyntaxError: Unexpected end of JSON input"

Hello, I followed the instructions on how to install the buildpack, but I get this error in the heroku console when I try to invoke google cloud storage functions:

2022-12-13T20:32:28.601333+00:00 app[web.1]: ERROR SyntaxError: Unexpected end of JSON input
2022-12-13T20:32:28.601354+00:00 app[web.1]:     at JSON.parse (<anonymous>)
2022-12-13T20:32:28.601354+00:00 app[web.1]:     at ReadStream.<anonymous> (/app/node_modules/google-auth-library/build/src/auth/googleauth.js:346:39)
2022-12-13T20:32:28.601355+00:00 app[web.1]:     at ReadStream.emit (node:events:513:28)
2022-12-13T20:32:28.601368+00:00 app[web.1]:     at endReadableNT (node:internal/streams/readable:1359:12)
2022-12-13T20:32:28.601369+00:00 app[web.1]:     at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I ran $ heroku run cat google-credentials.json and the output was empty:
Screen Shot 2022-12-13 at 3 41 01 PM

What should I do to debug this problem? Thank you so much!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.