Я настроил корзину в проекте для хранения загруженных файлов. Попытка удостовериться, что я могу записать в корзину с помощью программы тестового узла, которая загружает файл в корзину, которая не удается Затем я попытался скопировать файл в корзину, используя gsutil, и он повторяет попытки до истечения времени ожидания. При дальнейшем исследовании каждая команда, использующая gsutil, приводит к ошибке тайм-аута. Похоже, в интернете мало информации об этой ошибке.
Я удалил и заново сгенерировал файл .boto с gcloud init
Эта команда работает. Я также сделал чистую переустановку SDK дважды и до сих пор проблема. ACL для проекта и ведро включили меня. Ниже приведена программа узла и ошибка времени ожидания от gsutil cp test.txt gs://mybucket
const {Storage} = require('@google-cloud/storage');
// Creates a client
const storage = new Storage();
/**
* TODO(developer): Uncomment the following lines before running the sample.
*/
const bucketName = 'mybucket';
const filename = 'test.txt';
// Uploads a local file to the bucket
storage.bucket(bucketName).upload(filename, {
// Support for HTTP requests made with `Accept-Encoding: gzip`
gzip: true,
metadata: {
// Enable long-lived HTTP caching headers
// Use only if the contents of the file will never change
// (If the contents will change, use cacheControl: 'no-cache')
cacheControl: 'public, max-age=31536000',
},
});
console.log(`${filename} uploaded to ${bucketName}.`);
Ошибка в программе узла
(node:18471) UnhandledPromiseRejectionWarning: Error: Anonymous caller does not have storage.objects.create access to medchainvault/test.txt.
at Util.parseHttpRespBody (/home/russell/go/src/github.com/medchain/business-network/storage-server/node_modules/@google-cloud/common/build/src/util.js:172:38)
at Util.handleResp (/home/russell/go/src/github.com/medchain/business-network/storage-server/node_modules/@google-cloud/common/build/src/util.js:116:117)
at retryRequest (/home/russell/go/src/github.com/medchain/business-network/storage-server/node_modules/@google-cloud/common/build/src/util.js:403:22)
at onResponse (/home/russell/go/src/github.com/medchain/business-network/storage-server/node_modules/@google-cloud/common/node_modules/retry-request/index.js:200:7)
at /home/russell/go/src/github.com/medchain/business-network/storage-server/node_modules/teeny-request/build/src/index.js:158:17
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:18471) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:18471) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Ошибка от gsutil:
Traceback (most recent call last): 0.0 B/s
File "/usr/lib/google-cloud-sdk/platform/gsutil/gsutil", line 22, in <module>
gsutil.RunMain()
File "/usr/lib/google-cloud-sdk/platform/gsutil/gsutil.py", line 117, in RunMain
sys.exit(gslib.__main__.main())
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 407, in main
perf_trace_token=perf_trace_token, user_project=user_project)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/__main__.py", line 590, in _RunNamedCommandAndHandleExceptions
user_project=user_project)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/command_runner.py", line 372, in RunNamedCommand
return_code = command_inst.RunCommand()
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 1184, in RunCommand
seek_ahead_iterator=seek_ahead_iterator)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/command.py", line 1420, in Apply
arg_checker, should_return_results, fail_on_error)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/command.py", line 1491, in _SequentialApply
worker_thread.PerformTask(task, self)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/command.py", line 2157, in PerformTask
results = task.func(cls, task.args, thread_state=self.thread_gsutil_api)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 795, in _CopyFuncWrapper
preserve_posix=cls.preserve_posix_attrs)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/commands/cp.py", line 992, in CopyFunc
gzip_exts=self.gzip_exts, preserve_posix=preserve_posix))
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 3520, in PerformCopy
allow_splitting=allow_splitting, gzip_encoded=gzip_encoded)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 2026, in _UploadFileToObject
parallel_composite_upload, logger)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 1877, in _DelegateUploadFileToObject
elapsed_time, uploaded_object = upload_delegate()
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 2009, in CallNonResumableUpload
gzip_encoded=gzip_encoded_file)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/utils/copy_helper.py", line 1588, in _UploadFileToObjectNonResumable
fields=UPLOAD_RETURN_FIELDS, gzip_encoded=gzip_encoded)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/cloud_api_delegator.py", line 292, in UploadObject
gzip_encoded=gzip_encoded)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/gcs_json_api.py", line 1385, in UploadObject
gzip_encoded=gzip_encoded)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/gcs_json_api.py", line 1229, in _UploadObject
global_params=global_params)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/third_party/storage_apitools/storage_v1_client.py", line 1197, in Insert
download=download)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/apitools/apitools/base/py/base_api.py", line 729, in _RunMethod
http, http_request, **opts)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/apitools/apitools/base/py/http_wrapper.py", line 346, in MakeRequest
check_response_func=check_response_func)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/apitools/apitools/base/py/http_wrapper.py", line 396, in _MakeRequestNoRetry
redirections=redirections, connection_type=connection_type)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/gcs_json_media.py", line 276, in NewRequest
connection_type=override_connection_type)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/transport.py", line 159, in new_request
credentials._refresh(orig_request_method)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/client.py", line 761, in _refresh
self._do_refresh_request(http)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/google-reauth-python/google_reauth/reauth_creds.py", line 120, in _do_refresh_request
headers=headers))
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/google-reauth-python/google_reauth/reauth.py", line 269, in refresh_access_token
headers=headers)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/google-reauth-python/google_reauth/_reauth_client.py", line 151, in refresh_grant
headers=headers)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/google-reauth-python/google_reauth/reauth_creds.py", line 107, in http_request
body=body, headers=headers)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/oauth2client/oauth2client/transport.py", line 282, in request
connection_type=connection_type)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/httplib2/python2/httplib2/__init__.py", line 1694, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/httplib2/python2/httplib2/__init__.py", line 1434, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/lib/google-cloud-sdk/platform/gsutil/gslib/gcs_json_media.py", line 529, in _conn_request
conn.connect()
File "/usr/lib/google-cloud-sdk/platform/gsutil/third_party/httplib2/python2/httplib2/__init__.py", line 1100, in connect
sock.connect(sockaddr)
File "/usr/lib/python2.7/socket.py", line 228, in meth
return getattr(self._sock,name)(*args)
socket.timeout: timed out