Install buildpacks on already running app

Hello everyone! I have used Heroku to host my NodeJS app, and I have a custom google cloud integration. For Google Cloud to authenticate I had to add the following buildpack: “GitHub - buyersight/heroku-google-application-credentials-buildpack: Generates a Google credential file based on an environment variable”.

I have followed the tutorial to generate the .render-buildpacks.json file with your CLI plugin which holds my Heroku build packs and then added them to my project root. I have then redeployed the app, but when I try to upload a file to google storage I receive an error that it can’t authenticate, so the buildpack isn’t installed.

What am I doing wrong, and how can I install the buildpack correctly?

Thanks in advance!

I have fixed the issue by manually authenticating google storage, without the buildpack. But it will really be beneficial to know how to install buildpacks on already running apps. Thanks!

Hi there,

Thanks for reaching out.

Buildpacks are not natively supported by Render. The Heroku to Render migration tool simply recreates a Heroku environment in Docker. Is your project using the Docker environment with the Dockerfile.render created in the migration process? That’s where the .render-buildpacks.json would be read.

It usually works out a lot simpler to use a Render Native Environment to avoid some of the complications of bringing over Heroku’s Dockerized stack to our platform.

Looking at what that buildpack actually does:

echo "------> Generating .profile.d file to generate google-credentials.json at startup"mkdir -p $BUILD_DIR/.profile.dCREDENTIALS=$(cat ${ENV_DIR}/GOOGLE_CREDENTIALS)echo "echo ${CREDENTIALS@Q} > /app/google-credentials.json" > $BUILD_DIR/.profile.d/google-credentials.shchmod +x $BUILD_DIR/.profile.d/google-credentials.sh

It looks like it’s just taking some credentials in Heroku config vars and writing them to a file.

You could achieve the same on Render by creating your google-credentials.json as a secret file in the “Environment” tab of the service. It would be available in the root of your project & /etc/secrets/google-credentials.json. If you needed it somewhere else, you could add a copy command to the beginning of your Build and/or Start Commands, e.g. cp /etc/secrets/google-credentials.json ./my/required/path/google-credentials.json && your_build_or_start_commands

Hope that helps

Alan

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.