Google cloud storage 使用generateSignedPostPolicyV4的@google cloud/storage出错

Google cloud storage 使用generateSignedPostPolicyV4的@google cloud/storage出错,google-cloud-storage,Google Cloud Storage,我遵循这个例子: 我唯一的改变是: const bucketName = "gs://my-bucket.appspot.com/"; const filename = "test.jpg"; const { Storage } = require("@google-cloud/storage"); const storage = new Storage({ projectId: require("./key.json").project_id, credentials: requ

我遵循这个例子:

我唯一的改变是:

const bucketName = "gs://my-bucket.appspot.com/";
const filename = "test.jpg";

const { Storage } = require("@google-cloud/storage");

const storage = new Storage({
  projectId: require("./key.json").project_id,
  credentials: require("./key.json"),
});
然后我将输出导出到一个HTML文件来测试它:

node index.js > index.html
但当我提交文件时,我收到:

<Error>
   <Code>InvalidPolicyDocument</Code>
   <Message>
      The content of the form does not meet the conditions specified in the policy document.
   </Message>
   <Details>
      Policy did not reference these fields: bucket submit
   </Details>
</Error>
这是代码示例中的错误吗


我需要任何配置/权限吗?

我最后一次工作是在5月11日星期一。我认为他们更新了API,不会自动将bucket添加到字段列表中。修复很简单,只需在创建时将bucket添加到字段列表中

。。。
常量选项={
到期,
字段:{
“x-goog-meta-test”:“数据”,
“水桶”:“我的水桶”
},
};
...

编辑:找到引用此更改的PR。很快就会有修复。

可能不需要bucket name中的
gs://
,因为您共享的示例中指出
“bucket的名称,例如my bucket”
请尝试一下,让我知道它是否有效。@ralemos相同的问题=/是否有名为
bucket submit
的字段?错误消息表明有一个字段具有该名称/类型,这很奇怪,因为它可能是bucket或submit。这里的问题与此相同,30个小时前还在工作,但突然停止了。@ralemos很好地捕捉到了“submit”。它将提交按钮命名为
name='submit'
。但是没有水桶。