fix: use encoded service key to avoid railway parse problem#664
fix: use encoded service key to avoid railway parse problem#664
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
🚅 Deployed to the echo-pr-664 environment in echo
|
| // decode from base64 | ||
| const serviceAccountKey = Buffer.from( | ||
| serviceAccountKeyEncoded!, |
There was a problem hiding this comment.
| // decode from base64 | |
| const serviceAccountKey = Buffer.from( | |
| serviceAccountKeyEncoded!, | |
| if (!serviceAccountKeyEncoded) { | |
| return null; | |
| } | |
| // decode from base64 | |
| const serviceAccountKey = Buffer.from( | |
| serviceAccountKeyEncoded, |
The code uses a non-null assertion operator (!) on serviceAccountKeyEncoded without checking if it's defined first, which will cause a runtime TypeError if the environment variable is not set.
View Details
Analysis
TypeError in VertexAIProvider.getServiceAccountCredentials() when GOOGLE_SERVICE_ACCOUNT_KEY_ENCODED is undefined
What fails: VertexAIProvider.getServiceAccountCredentials() throws TypeError when environment variable GOOGLE_SERVICE_ACCOUNT_KEY_ENCODED is not set
How to reproduce:
# Ensure environment variable is not set
unset GOOGLE_SERVICE_ACCOUNT_KEY_ENCODED
# Call any method that uses Vertex AI authentication (getAccessToken, initializeStorage)Result: TypeError: "The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined"
Expected: Method should return null when credentials are unavailable, consistent with initializeStorage() method which checks if (!credentials) and returns null per lines 280-283 in packages/app/server/src/providers/VertexAIProvider.ts
No description provided.