我正在失去理智。
我将 Shrine ( https://github.com/janko-m/shrine ) 与 Google Cloud Storage ( https://github.com/renchap/shrine-google_cloud_storage ) 一起使用,但是当我开始PUT
通话时,我得到了这个:
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your Google secret key and signing method.
</Message>
<StringToSign>
PUT
image/jpeg
1518399402
/mybucket.appspot.com/7d5e4aad1e3a737fb8d2c59571fdb980.jpg
</StringToSign>
</Error>
我关注了这个信息(http://shrinerb.com/rdoc/classes/Shrine/Plugins/PresignEndpoint.html)presign_endpoint
,但仍然没有:
class FileUploader < Shrine
plugin :presign_endpoint, presign_options: -> (request) do
filename = request.params["filename"]
extension = File.extname(filename)
content_type = Rack::Mime.mime_type(extension)
{
content_type: content_type
}
end
end
我尝试了有无这个(每次都重新启动 Rails 服务器)。
我哪里错了?
我还尝试使用带有 PUT 到该 URL 并且没有任何content-type的 Postman 。但还是一无所获。
我在这里阅读:https ://github.com/GoogleCloudPlatform/google-cloud-node/issues/1976和这里:https ://github.com/GoogleCloudPlatform/google-cloud-node/issues/1695
如果没有 Rails,我该如何尝试?
是否有 REPL(或类似的)可以尝试使用我的凭据和文件?