[GH-ISSUE #392] Access control list in fake-gcs-server #2225

Closed
opened 2026-03-15 18:07:10 +03:00 by kerem · 0 comments
Owner

Originally created by @azoom-l-v-long on GitHub (Jan 11, 2021).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/392

First, thank you for writing this!

Currently, I want to use fake-gcs-server in a local development environment and t need some features for your company's projects.

  1. upload file: worked
  2. copying, renaming, and moving objects: ……
  3. get singed url: not working
  4. using acl to restrict access level: not working

but for item 3, 4 does not work properly with my wishes
here, I use addAllUser
const bucket = await storage.bucket('gcs-bucket-test')
const acl = await bucket.file('fileName.png').acl
await acl.owners.addAllUsers()
or
const options = {
entity: 'allUsers'
role: storage.acl.READER_ROLE
}
const file = await bucket.file('fileName.png')
await file.acl.add(options).then(function (data) {
const aclObject = data[0]
const apiResponse = data[1]
})
I received an error like below
Please let me know fake-gcs can assist me with this but this doesn't
{ Error: Not found
at new ApiError (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:59:15)
at Util.parseHttpRespBody (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:194:38)
at Util.handleResp (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:135:117)
at retryRequest (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:434:22)
at onResponse (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/retry-request/index.js:214:7)
at res.text.then.text (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/teeny-request/build/src/index.js:219:13)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 404,
errors: null,
response:
PassThrough {
_readableState:
ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: false,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
paused: false,
emitClose: true,
autoDestroy: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
_events:
[Object: null prototype] {
prefinish: [Function: prefinish],
error: [Array],
data: [Function],
end: [Function] },
_eventsCount: 4,
_maxListeners: undefined,
_writableState:
WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: true,
ended: true,
finished: true,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: true,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object] },
writable: false,
allowHalfOpen: true,
_transformState:
{ afterTransform: [Function: bound afterTransform],
needTransform: false,
transforming: false,
writecb: null,
writechunk: null,
writeencoding: 'buffer' },
statusCode: 404,
statusMessage: 'Not Found',
request:
{ agent: [Agent],
headers: [Object],
href:
'http://localhost:4443/storage/v1/b/gcs-bucket-test/o/fileName.png/acl?' },
body:
'{"error":{"code":404,"message":"Not found","errors":null}}\n',
headers:
{ 'content-length': '59',
'content-type': 'text/plain; charset=utf-8',
date: 'Mon, 11 Jan 2021 08:27:13 GMT' },
toJSON: [Function: toJSON] },
message: 'Not found' }

Originally created by @azoom-l-v-long on GitHub (Jan 11, 2021). Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/392 **First, thank you for writing this!** **Currently, I want to use fake-gcs-server in a local development environment and t need some features for your company's projects.** 1. upload file: worked 2. copying, renaming, and moving objects: …… 3. get singed url: not working 4. using acl to restrict access level: not working but for item 3, 4 does not work properly with my wishes here, I use addAllUser `const bucket = await storage.bucket('gcs-bucket-test')` `const acl = await bucket.file('fileName.png').acl` `await acl.owners.addAllUsers()` or `const options = {` ` entity: 'allUsers'` ` role: storage.acl.READER_ROLE` `}` `const file = await bucket.file('fileName.png')` `await file.acl.add(options).then(function (data) {` ` const aclObject = data[0]` ` const apiResponse = data[1]` ` })` **I received an error like below** **Please let me know fake-gcs can assist me with this but this doesn't** { Error: Not found at new ApiError (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:59:15) at Util.parseHttpRespBody (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:194:38) at Util.handleResp (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:135:117) at retryRequest (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/@google-cloud/common/build/src/util.js:434:22) at onResponse (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/retry-request/index.js:214:7) at res.text.then.text (/Users/azoomdev/Desktop/WORK/fake-gcs/node_modules/teeny-request/build/src/index.js:219:13) at process._tickCallback (internal/process/next_tick.js:68:7) code: 404, errors: null, response: PassThrough { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { head: null, tail: null, length: 0 }, length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: false, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, paused: false, emitClose: true, autoDestroy: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, _events: [Object: null prototype] { prefinish: [Function: prefinish], error: [Array], data: [Function], end: [Function] }, _eventsCount: 4, _maxListeners: undefined, _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: true, ended: true, finished: true, destroyed: false, decodeStrings: true, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: false, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: true, errorEmitted: false, emitClose: true, autoDestroy: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: false, allowHalfOpen: true, _transformState: { afterTransform: [Function: bound afterTransform], needTransform: false, transforming: false, writecb: null, writechunk: null, writeencoding: 'buffer' }, statusCode: 404, statusMessage: 'Not Found', request: { agent: [Agent], headers: [Object], href: 'http://localhost:4443/storage/v1/b/gcs-bucket-test/o/fileName.png/acl?' }, body: '{"error":{"code":404,"message":"Not found","errors":null}}\n', headers: { 'content-length': '59', 'content-type': 'text/plain; charset=utf-8', date: 'Mon, 11 Jan 2021 08:27:13 GMT' }, toJSON: [Function: toJSON] }, message: 'Not found' }
kerem 2026-03-15 18:07:10 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#2225
No description provided.