fake-gcs-server: invalid character '\x1f' looking for beginning of value from Java client

Creating a bucket on fake-gcs-server using the Java Storage client failed with: invalid character '\x1f' looking for beginning of value, raised from HttpStorageRpc.translate. Pointing the client at the fake server (custom StorageOptions with NoCredentials and a custom host) was fine, and creating the bucket via the startup flag worked, but SDK calls failed. Another user traced it: \x1f is the first byte of a gzipped payload. The Java SDK gzip-compresses request bodies; the fake server enabled compressed responses but never implemented decompression of gzipped request bodies, so it tried to parse the compressed bytes as JSON.

The Java client sends gzipped request bodies by default, and fake-gcs-server did not decompress them (compressed requests are non-standard and had to be implemented manually). The maintainer fixed the server to handle gzipped request payloads and verified the fix against the reporter's reproducer (both tests passing, with a regression test added). Upgrade fake-gcs-server past the 2021-02-01 fix. As a workaround on old versions, disable gzip in the client.

Source: https://github.com/fsouza/fake-gcs-server/issues/142

Source: https://github.com/fsouza/fake-gcs-server/issues/142