{"record":{"id":"158262618d829bd9","repo":"FlowiseAI/Flowise","slug":"please-specify-your-google-application-credential","errorCode":null,"errorMessage":"Please specify your Google Application Credential","messagePattern":"Please specify your Google Application Credential","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/google-utils.ts","lineNumber":15,"sourceCode":"import { getCredentialData, getCredentialParam, type ICommonObject, type INodeData } from '.'\nimport type { ChatVertexAIInput, VertexAIInput } from '@langchain/google-vertexai'\n\ntype SupportedAuthOptions = ChatVertexAIInput['authOptions'] | VertexAIInput['authOptions']\n\nexport const buildGoogleCredentials = async (nodeData: INodeData, options: ICommonObject): Promise<SupportedAuthOptions | null> => {\n    const credentialData = await getCredentialData(nodeData.credential ?? '', options)\n    const googleApplicationCredentialFilePath = getCredentialParam('googleApplicationCredentialFilePath', credentialData, nodeData)\n    const googleApplicationCredential = getCredentialParam('googleApplicationCredential', credentialData, nodeData)\n    const projectID = getCredentialParam('projectID', credentialData, nodeData)\n\n    const authOptions: any = {}\n    if (Object.keys(credentialData).length !== 0) {\n        if (!googleApplicationCredentialFilePath && !googleApplicationCredential)\n            throw new Error('Please specify your Google Application Credential')\n        if (!googleApplicationCredentialFilePath && !googleApplicationCredential)\n            throw new Error(\n                'Error: More than one component has been inputted. Please use only one of the following: Google Application Credential File Path or Google Credential JSON Object'\n            )\n\n        if (googleApplicationCredentialFilePath && !googleApplicationCredential) authOptions.keyFile = googleApplicationCredentialFilePath\n        else if (!googleApplicationCredentialFilePath && googleApplicationCredential)\n            authOptions.credentials = JSON.parse(googleApplicationCredential)\n\n        if (projectID) authOptions.projectId = projectID\n    }\n\n    return authOptions\n}\n","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/google-utils.ts#L1-L30","documentation":"buildGoogleCredentials() requires at least one of googleApplicationCredentialFilePath (path to a service-account JSON file) or googleApplicationCredential (the JSON content as a string) when a credential is attached (Object.keys(credentialData).length !== 0). If both are empty the function throws. Note: the immediately following 'More than one component' check on line 16 uses the SAME condition as line 14 and is therefore dead code — it can never fire, and the intended 'provided both' case is not actually guarded.","triggerScenarios":"A Google credential component is attached to the node (so credentialData is non-empty) but neither the file path nor the JSON object field is filled in.","commonSituations":"Created a Google Auth credential record but left both fields blank; the file path was cleared during an edit; migrating from file path to JSON object and removed the path before adding the JSON.","solutions":["Provide EITHER the service-account JSON file path in googleApplicationCredentialFilePath OR paste the JSON content into googleApplicationCredential.","Verify the credential component attached to the node is the one you intend (nodeData.credential resolves to it).","If you intend to use Application Default Credentials via the environment, remove the credential from the node entirely so credentialData is empty and the function returns empty authOptions (falls back to ADC).","Report the dead-code 'More than one component' branch: its condition should be `googleApplicationCredentialFilePath && googleApplicationCredential` to actually guard the both-provided case."],"exampleFix":"// before: credential attached, both fields blank\ncredentialData = { name: 'GoogleAuth' } // no file path, no JSON\nbuildGoogleCredentials(nodeData, options) // throws\n\n// after: provide one\ncredentialData.googleApplicationCredentialFilePath = '/etc/flowise/gcp-sa.json'","handlingStrategy":"validation","validationCode":"// Validate Google credential shape before calling buildGoogleCredentials\nfunction assertGoogleCredential(credentialData) {\n    if (Object.keys(credentialData).length === 0) return // ADC fallback is fine\n    const { googleApplicationCredentialFilePath, googleApplicationCredential } = credentialData\n    if (!googleApplicationCredentialFilePath && !googleApplicationCredential) {\n        throw new Error('Provide either googleApplicationCredentialFilePath or googleApplicationCredential')\n    }\n    if (googleApplicationCredentialFilePath && googleApplicationCredential) {\n        throw new Error('Provide only ONE of file path or JSON object')\n    }\n}","typeGuard":"function hasGoogleCredentialSource(credentialData) {\n    const { googleApplicationCredentialFilePath, googleApplicationCredential } = credentialData\n    return Boolean(googleApplicationCredentialFilePath) !== Boolean(googleApplicationCredential) // exactly one\n}","tryCatchPattern":"try {\n    const auth = await buildGoogleCredentials(nodeData, options)\n} catch (e) {\n    if (/specify your Google Application Credential/i.test(e.message)) {\n        // prompt the user to attach a Google credential with a file path or JSON\n    }\n    throw e\n}","preventionTips":["Provide exactly one of file-path or JSON for Google credentials.","If relying on ADC, do not attach a credential component to the node at all.","Report the dead-code 'More than one component' branch upstream — its condition is identical to the 'Please specify' check and never fires."],"tags":["google","credentials","vertex-ai","configuration"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}