我遵循这个示例:https://github.com/googleapis/nodejs-storage/blob/master/samples/generateV4SignedPolicy.js
我唯一的改变是:
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>这是代码示例中的一个bug吗?
我这一方是否需要任何配置/权限?
发布于 2020-05-14 03:20:55
我最后一次工作是在5月11日,星期一。我想他们更新了API,不会自动将存储桶添加到字段列表中。修复很简单,只需在创建时将存储桶添加到字段列表中即可。
...
const options = {
expires,
fields: {
'x-goog-meta-test': 'data',
'bucket': 'my-bucket'
},
};
...编辑:找到引用此重大变更的请购单。https://github.com/googleapis/conformance-tests/pull/31。There will likely be an update to @google-cloud/storage module很快就会修复这个问题。
https://stackoverflow.com/questions/61717588
复制相似问题