1
이 코드가 성공적으로 작동하는 다른 프로젝트가 있기 때문에 이번에는 놓친 몇 가지 구성 옵션이 될 수 있습니다. firebase 저장소에 액세스하기 위해 Google 클라우드 API를 사용하고 있습니다.파일 확인 후 Google 클라우드 404
명확한 설명을 위해 파일 은입니다. 대신 인쇄
var storage = require('@google-cloud/storage')({
\t \t keyFilename: 'serviceAccountKey.json',
\t \t projectId: 'my-id'
\t });
var bucket = storage.bucket('my-id.appspot.com');
var file = bucket.file('directory/file.json'); //this exists!
file.exists(function(err, exists){
console.log("Checking for challenges file. Results:" + exists + ", err:" + err); //returns "Checking for challenges file. Results:true, err:nil"
if (exists) {
\t console.log("File exists. Printing."); //prints "File exists. Printing."
\t file.download().then(function(currentFileData) {
\t \t console.log("This line is never reached.");
\t }).catch(err => {
\t \t console.error('ERROR:', err); //gives a 404 error
\t });
}
});
ERROR: { ApiError: Not Found at Object.parseHttpRespMessage (/user_code/node_modules/@google-cloud/storage/node_modules/@google-cloud/common/src/util.js:156:33) at Object.handleResp ... ...
전체 오류가 거대한, 그래서 여기에 게시하지 않습니다 그 필요하지 않으면 전체.
양동이는 프로젝트에 연결되어 있습니다. 동일한 디렉토리에 동일한 파일을 가지고있는 두 프로젝트 모두에 확신합니까? – MondKin
예, 확실합니다. X 개의 파일 (최대 8 개)이 있는데이 파일을 변경하는 파일 변수로 다시 실행합니다. 3 개의 파일이있을 때 Exx는 3 번 발견되기 때문에 3 번 실행되지만 3 번 오류가 발생하기 때문에 오류가 발생합니다 (각 기존 파일마다 하나씩 오류가 발생하기 때문에). –
Google Cloud에 대한 문서를 확인하면 코드에 문제가없는 것으로 보이므로 버킷의 권한 문제 일뿐입니다. 파일을 나열 할 수는 있지만 파일 내용에 액세스 할 수는 없습니까? – MondKin