{"record":{"id":"b2872b1f3d3d153b","repo":"apache/seatunnel","slug":"failed-to-initialize-google-service-account-creden","errorCode":null,"errorMessage":"Failed to initialize Google Service Account credentials","messagePattern":"Failed to initialize Google Service Account credentials","errorType":"exception","errorClass":"SeaTunnelException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-firebase/src/main/java/org/apache/seatunnel/connectors/seatunnel/firebase/client/FirebaseHttpClient.java","lineNumber":298,"sourceCode":"        }\n    }\n\n    private GoogleCredentials initGoogleCredentials(ReadonlyConfig config) {\n        try {\n            if (config.getOptional(FirebaseSourceOptions.CREDENTIALS).isPresent()) {\n                String base64Credentials = config.get(FirebaseSourceOptions.CREDENTIALS);\n                byte[] decodedBytes = Base64.getDecoder().decode(base64Credentials);\n                try (InputStream inputStream = new ByteArrayInputStream(decodedBytes)) {\n                    return GoogleCredentials.fromStream(inputStream).createScoped(FIREBASE_SCOPES);\n                }\n            } else if (config.getOptional(FirebaseSourceOptions.SERVICE_ACCOUNT_PATH).isPresent()) {\n                String path = config.get(FirebaseSourceOptions.SERVICE_ACCOUNT_PATH);\n                try (InputStream inputStream = new FileInputStream(path)) {\n                    return GoogleCredentials.fromStream(inputStream).createScoped(FIREBASE_SCOPES);\n                }\n            }\n        } catch (IOException e) {\n            throw new SeaTunnelException(\n                    \"Failed to initialize Google Service Account credentials\", e);\n        }\n        return null;\n    }\n}\n","sourceCodeStart":280,"sourceCodeEnd":304,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-firebase/src/main/java/org/apache/seatunnel/connectors/seatunnel/firebase/client/FirebaseHttpClient.java#L280-L304","documentation":"initGoogleCredentials loads Google service account credentials (from JSON content or a key file path) and throws this SeaTunnelException on IOException. Failures include the key file not existing, being unreadable, or containing invalid JSON. It prevents the source from initializing with broken authentication.","triggerScenarios":"service_account_path points to a missing or unreadable file; the key JSON is malformed; an IO error occurs while reading the configured credential source.","commonSituations":"Wrong file path in containerized deployments (file not mounted into the pod); file permissions denying read; truncated or edited service-account JSON; using a path in a format (PKCS12) not supported by fromStream.","solutions":["Verify service_account_path exists and is readable by the SeaTunnel process (ls -l, check mount).","Re-download the service account key JSON from Google Cloud Console and replace a corrupt file.","Embed the JSON via service_account_json option instead of a path if file mounting is problematic.","Confirm the file is a standard JSON service-account key, not a PKCS12 (.p12) file."],"exampleFix":"// before\nservice_account_path = \"/secrets/sa.json\" // file not mounted in container\n// after\n# docker run -v /local/sa.json:/secrets/sa.json ...\nservice_account_path = \"/secrets/sa.json\"","handlingStrategy":"validation","validationCode":"String path = config.get(FirebaseSourceOptions.SERVICE_ACCOUNT_PATH);\nFile f = new File(path);\nif (!f.isFile() || !f.canRead()) throw new IllegalStateException(\"unreadable service account file: \" + path);","typeGuard":null,"tryCatchPattern":"try { client = new FirebaseHttpClient(config); } catch (SeaTunnelException e) { if (e.getMessage().contains(\"credentials\")) { fixCredentialSource(); } throw e; }","preventionTips":["Mount the key file into containers and verify with ls -l","Use service_account_json instead of a path when mounting is hard","Re-download the key if JSON may be corrupt","Ensure the key is JSON format, not PKCS12"],"tags":["firebase","gcp","authentication","io"],"backgroundTag":"file-read-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}