GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [google-auth-library-java] external_account (AWS) Credentials NPE after Java deserialization: transient HttpTransportFactory not restored on refresh · Issue #14050 · googleapis/google-cloud-java Closed Labels priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. DescriptionSummaryWhen an The region-lookup / STS path then dereferences the null transport and fails with: com.google.api.client.googleapis.json.GoogleJsonResponseException / IllegalStateException Why this matters / real-world triggerDistributed frameworks routinely serialize a
Minimal reproductionimport com.google.auth.oauth2.GoogleCredentials; import java.io.*; public class Repro { public static void main(String[] args) throws Exception { // external_account (AWS) config; GOOGLE_APPLICATION_CREDENTIALS points at it, // or load via GoogleCredentials.fromStream(new FileInputStream(...)). GoogleCredentials cred = GoogleCredentials.getApplicationDefault() .createScoped("https://www.googleapis.com/auth/cloud-platform"); // Round-trip through Java serialization (what Spark does driver -> executor). byte[] bytes; try (var bos = new ByteArrayOutputStream(); var oos = new ObjectOutputStream(bos)) { oos.writeObject(cred); oos.flush(); bytes = bos.toByteArray(); } GoogleCredentials restored; try (var ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) { restored = (GoogleCredentials) ois.readObject(); } // Fresh instance refreshes fine; the deserialized one NPEs because transportFactory == null. restored.refresh(); // <-- NullPointerException here } } Run on an AWS host (EC2, so IMDS is reachable) with an external_account AWS credential config. Root cause The internal AWS security-credentials supplier holds an HttpTransportFactory marked transient. Expected behavior After deserialization, refresh() should work: the transport should be restored to the default Workaround (for others hitting this) Don't serialize a live credential across JVMs. Instead serialize the config bytes and rebuild Environment
Activity
MetadataMetadataAssigneesLabelspriority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |