Skip to content

using the emulator, upload a file then downloading it return 404 #209

Open
@Raffaello

Description

Describe the bug
A clear and concise description of what the bug is.
uploading a file succesfully, then when try to downloading is returning 404.

[SERVER] All services started
"POST /upload/storage/v1/b/local-bucket/o?name=Example.xml&uploadType=resumable HTTP/1.1" 200 -
No file to remove '_resumable/6effa36d984da5caa33e4f5fb3a0f70e54ab18f801d03504f7cd2fdaa38e2cc5'
"PUT /upload/storage/v1/b/local-bucket/o?name=Example.xml&uploadType=resumable&upload_id=local-bucket%3AExample.xml%3A2022-10-21+13%3A31%3A18.531160 HTTP/1.1" 200 -
Resource not found:
**resource 'b' not found**
"GET /b/local-bucket/o/Example.xml?alt=media HTTP/1.1" 404 -

the url to get /b is the standard GCP Storage url bucket /o obect.
it isn't expected to fail on a GET /b url

To Reproduce
A minimal, complete, and reproducible example to reproduce the behavior.

  1. upload a file with NodeJS
  2. downaload a file with NodeJS
import { Storage } from "@google-cloud/storage"
import process from "process"

const HOST = "localhost"
const PORT = 9023
const BUCKET = "local-bucket"

process.env.STORAGE_EMULATOR_HOST = `http://${HOST}:${PORT}`

const storage = new Storage()

async function upload(filePath, destinationFilename) {
    const resp = await storage.bucket(BUCKET).upload(filePath,{
        destination: destinationFilename
    })
}
// USAGE needs filepath to upload and the name of the file at destination:
// e.g. local_storage_upload mypath/filename.txt filename.txt
upload(process.argv[2], process.argv[3]).catch(console.error)

// usage npx local-storage_upload.ts filetoUpload.txt filetoUpload.txt

download:

const [fileData] = await this.storage.bucket("local-bucket").file("fileToUpload.txt).download({ validation: "md5" });
// this will trigger 404 and throw exception as file not found

Expected behavior
it should download the file

System (please complete the following information):

  • gcp-storage-emulator version: latest, there is no way to retrieve from -h argument or a --version argument.

Additional context
Add any other context about the problem here.

Basically what is saying is "url not found" `b/" the b/ part of the path is the "bucket" in GCP storage. so it should just work without any further issue as it is the basic GCP storage url

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions