I ran into similar problem with uploadTask(with: request, fromFile: file), the root cause is that the uploadTask(fromFile:) extension will automatically append the header with 'application/octet-stream' as Content-Type if that is not set in the header. While the GCS bucket is expecting an empty Content-Type, thus it keeps failing the upload with a "SignatureDoesNotMatch" error.
I will suggest double check your server's expectation on the Content-Type, and might try setting use headers like let headers = ["Content-Type": "", ...]