Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage emulator: file#copy failed with an error - Not Implemented #3751

Closed
MarcusCemes opened this issue Sep 12, 2021 · 4 comments · Fixed by #3647
Closed

Storage emulator: file#copy failed with an error - Not Implemented #3751

MarcusCemes opened this issue Sep 12, 2021 · 4 comments · Fixed by #3647

Comments

@MarcusCemes
Copy link

[REQUIRED] Environment info

firebase-tools: 9.18.0

Platform: Windows

[REQUIRED] Test case

exports.storageFinalise = functions().storage.object().onFinalize(async (object) => {
  await storage().bucket().file(object.name).move("some/other/path");
})

[REQUIRED] Steps to reproduce

  1. Create a cloud storage trigger that copies or moves the object to another location
  2. Setup the cloud storage and functions emulator environment
  3. Upload a file to the storage emulator and review the logs

[REQUIRED] Expected behavior

The object can be copied or moved to a different location in the same bucket.

[REQUIRED] Actual behavior

The triggered function encounters an error, it receives an HTTP Not Implemented response from the storage emulator.

function[europe-west3-storageFinalise]
Error: file#copy failed with an error - Not Implemented
    at new ApiError (C:\Users\Marcus\[...]\functions\node_modules\.pnpm\@google-cloud+common@3.7.1\node_modules\@google-cloud\common\build\src\util.js:73:15)
    at Util.parseHttpRespMessage (C:\Users\Marcus\[...]\functions\node_modules\.pnpm\@google-cloud+common@3.7.1\node_modules\@google-cloud\common\build\src\util.js:175:41)
    at Util.handleResp (C:\Users\Marcus\[...]\functions\node_modules\.pnpm\@google-cloud+common@3.7.1\node_modules\@google-cloud\common\build\src\util.js:149:76)
    at C:\Users\Marcus\[...]\functions\node_modules\.pnpm\@google-cloud+common@3.7.1\node_modules\@google-cloud\common\build\src\util.js:477:22
    at onResponse (C:\Users\Marcus\[...]\functions\node_modules\.pnpm\retry-request@4.2.2\node_modules\retry-request\index.js:228:7)
    at C:\Users\Marcus\[...]\functions\node_modules\.pnpm\teeny-request@7.1.1\node_modules\teeny-request\build\src\index.js:226:13
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

The cloud storage emulator is very new, is copying files supported from the admin SDK or is it a very basic implementation for serving files to the client?

@abeisgoat
Copy link
Contributor

It is not currently support, as a rule of thumb, if you can do it in the Firebase client SDK then the same admin methods will also work, but things like moving files (which are admin / Google Cloud API endpoints) are not, but I'll make a note that this is something that is being attempted for when we work to expand the Cloud API surface compatibility.

@rhodgkins
Copy link
Contributor

I had similar problems so implemented various missing features of the Storage emulator - its still waiting to be merged :-/
You could try working against this and see if it fixes your problem and try upvoting / commenting on the PR.

@adsee42
Copy link

adsee42 commented Nov 5, 2021

Is this happen only with emulator?
If cloud function deployed, the move will work???

@akashdeep-sarin
Copy link

move() is not implemented as of 2024 :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants