Google Drive + Netlify env setup
for contractor paperwork storage.
The contractor onboarding form is already wired to a Netlify Function. That function can save W-9s, signed acknowledgments, optional ID files, payout profiles, and contractor packet summaries into your Google Drive. To make it work live, set four environment variables: GOOGLE_DRIVE_FOLDER_ID, GOOGLE_SERVICE_ACCOUNT_EMAIL, GOOGLE_PRIVATE_KEY, and CONTRACTOR_PACKET_ENCRYPTION_KEY_BASE64.
Fast checklist
Do these steps in order. The Drive folder and service account must be connected before the upload function can save real files.
skyes-contractor-packets. Official docs: Create service accounts.Skyes AE Contractor Packets. Open it and copy the folder ID from the URL. Google Drive API treats folders as Drive files with the folder MIME type; official folder docs are here: Create and populate folders..iam.gserviceaccount.com. Share the Drive folder with that email as Editor. The upload function writes into that folder using the service account./ae-command-hub/onboarding.html, submit a test packet, and confirm a new folder appears inside your Drive packet folder.Exactly what each variable means
Use this table when you are copying values into Netlify. Do not paste the entire JSON key into every variable. Only paste the matching field.
| Netlify variable | Where to get it | What it looks like | Common mistake |
|---|---|---|---|
| GOOGLE_DRIVE_FOLDER_ID | Open your Drive folder and copy the folder ID from the URL after /folders/. | 1AbCDeFgHIjKlmNoPqRstUV... | Do not paste the full folder URL. Paste only the ID. |
| GOOGLE_SERVICE_ACCOUNT_EMAIL | Open the downloaded JSON key and copy the client_email value. | skyes-contractor-packets@project-id.iam.gserviceaccount.com | Do not use your Gmail address here. |
| GOOGLE_PRIVATE_KEY | Open the downloaded JSON key and copy the full private_key value. | -----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n | Do not remove the \n sequences. The included function converts them back into real line breaks. |
| CONTRACTOR_PACKET_ENCRYPTION_KEY_BASE64 | Generate a 32-byte base64 key using the command below. | uM2...base64...= | Do not invent a password. It must decode to exactly 32 bytes. |
Generate the encryption key
The upload function uses AES-256-GCM and expects a base64 value that decodes to exactly 32 bytes. Node's official crypto documentation includes crypto.randomBytes(size), which generates cryptographically strong random data.
Node command
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Use this if Node is installed locally, in Codespaces, or in a Netlify/terminal environment.
OpenSSL command
openssl rand -base64 32
Use this if OpenSSL is available in your terminal.
Netlify setup path
Use the Netlify UI first. It is safer than hardcoding secrets in the repo. The function reads these values from process.env at runtime.
UI steps
- Open Netlify.
- Select the deployed Skyes Over London site.
- Open Site configuration.
- Open Environment variables.
- Add each variable from the value map.
- Mark secret/sensitive values as secret if your plan/UI exposes that option.
- Make sure the variables are available to Functions.
- Trigger a fresh deploy.
Variable names to add
GOOGLE_DRIVE_FOLDER_ID= GOOGLE_SERVICE_ACCOUNT_EMAIL= GOOGLE_PRIVATE_KEY= CONTRACTOR_PACKET_ENCRYPTION_KEY_BASE64=
Do not commit these values to GitHub. Keep them in Netlify environment variables only.
Google Drive folder setup
The easiest reliable setup is to create the folder manually in your own Drive, then share it with the service account as Editor.
Find the folder ID
Open the folder in Drive. The URL usually looks like this:
https://drive.google.com/drive/folders/FOLDER_ID_HERE
Copy only FOLDER_ID_HERE.
Share the folder
Click Share. Paste the service account email. Set it to Editor. Save.
Without this, the function will authenticate but fail to create folders/files.
Confirm upload path
Submit one test onboarding packet. You should see a child folder named like ae-YYYYMMDD... inside the Drive folder.
Google Drive upload docs explain API file uploads and Drive folder docs explain folder behavior.
Service account JSON cheat sheet
Open the JSON key file in a text editor. You are looking for these fields.
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "...",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "skyes-contractor-packets@your-project-id.iam.gserviceaccount.com",
"client_id": "..."
}Test checklist
Use this after Netlify redeploys.
Pass conditions
/ae-command-hub/onboarding.htmlopens behind the protected login.- The form submits without a server error.
- A new folder appears inside the Google Drive packet folder.
- The folder contains the uploaded W-9 file.
- The folder contains
contractor-onboarding-summary.json. - The folder contains
contractor-payment-profile.encrypted.json. - The folder contains
contractor-agreement-acceptance.html.
If it fails
- Missing environment variables: confirm all four names are spelled exactly.
- Invalid private key: make sure
GOOGLE_PRIVATE_KEYincludes the full key and\nsequences. - Permission denied: share the Drive folder with the service account email as Editor.
- Encryption key error: regenerate with the Node command and confirm it is base64 from 32 bytes.
- Changes not taking effect: redeploy after updating Netlify variables.