Google 云函数 - Python - 无法解码 gzip

Google Cloud Function - Python - Unable to decode gzip

我正在构建一个 Google Cloud Function,它将接收来自 Google PubSub 主题的消息。

在大量插入消息时,我在函数的日志中看到以下错误:

('Received response with content-encoding: gzip, but failed to decode it.', error('Error -3 while decompressing data: incorrect header check')), retrying in 1 seconds...

这种情况有几次不一致:

  1. 大多数邮件不会发生这种情况
  2. 失败次数不一致 - 从一次到连续 40 次。

我的邮件没有经过 gzip 压缩,其中没有“Content-Encoding”属性。

我的函数代码没有执行,这是在到达我的函数代码之前在 gcp 函数后端发生的。

该函数确实有效并且消息被执行,但我想调查为什么我遇到这个问题。

问题

  1. 导致此问题的原因可能是什么?
  2. 我该如何解决?

当我将 Python 3.7 升级到 3.8 时,问题已解决。

这似乎是函数后端或使用的某些库中的错误。