Support credential files as environment variables

Some popular APIs, like some of Google’s, use credential files. These are a pain to deal with.

We should support uploading these in the new environment variables panel in the dashboard.

Workaround

  1. Convert the file to base64 (on a Mac in terminal):

base64 path/to/your/service-account-file.json
  1. Then you'd set it as an env var on our side: https://trigger.dev/docs/deploy-environment-variables

  1. Then inside your Trigger.dev code:

const credentials = JSON.parse(Buffer.from(process.env.GOOGLE_CREDENTIALS_BASE64, 'base64').toString('utf8'));

const { google } = require('googleapis');
const auth = new google.auth.GoogleAuth({
  credentials,
  scopes: ['https://www.googleapis.com/auth/cloud-platform'],
});

const client = await auth.getClient();

Upvoters
Status

In Review

Board

💡 Feature Request

Date

Over 1 year ago

Author

mattaitken

Subscribe to post

Get notified by email when there are changes.