Skip to content

501 error when using Storage emulator #1791

@ir-fuel

Description

@ir-fuel

[REQUIRED] Step 2: Describe your environment

  • Operating System version: macOS 12.4
  • Firebase SDK version: 11.0.0
  • Firebase Product: storage (auth, database, storage, etc)
  • Node.js version: 16.15.0
  • NPM version: 8.5.5

[REQUIRED] Step 3: Describe the problem

When running the below code against the Firebase emulator suite I get a 501 not implemented error:

    await admin.storage()
      .bucket()
      .file(`images/${imageUID}`)
      .delete()

Steps to reproduce:

Run the firebase emulator and make sure the Storage emulator is running.

Try deleting a document in a bucket.

Relevant Code:

    await admin.storage()
      .bucket()
      .file(`images/${imageUID}`)
      .delete()

This is what gets printed:

ApiError: Not Implemented
....
 code: 501,
request: {
      agent: [Agent],
      headers: [Object],
      href: 'http://localhost:9199/b/localhost:9199?ns=xxxxxxxx/o/images%2F8354562864-5aeb7fa0-176b-58a0-5990-e4ad777c32ef?'
    },
    body: 'Not Implemented',
    headers: {
      'access-control-expose-headers': 'content-type,x-firebase-storage-version,x-goog-upload-url,x-goog-upload-status,x-goog-upload-command,x-gupload-uploadid,x-goog-upload-header-content-length,x-goog-upload-header-content-type,x-goog-upload-protocol,x-goog-upload-status,x-goog-upload-chunk-granularity,x-goog-upload-control-url',
      connection: 'keep-alive',
      'content-length': '15',
      'content-type': 'text/plain; charset=utf-8',
      date: 'Thu, 30 Jun 2022 09:00:33 GMT',
      etag: 'W/"f-fQJ74SexLoe24pZkYfRXD2evSf4"',
      'keep-alive': 'timeout=5',
      vary: 'Origin',
      'x-powered-by': 'Express'
    },

The emulator is running:

┌────────────────┬────────────────┬─────────────────────────────────┐
│ Emulator       │ Host:Port      │ View in Emulator UI             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Authentication │ 0.0.0.0:9099   │ http://localhost:4000/auth      │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Functions      │ 0.0.0.0:5001   │ http://localhost:4000/functions │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Firestore      │ 0.0.0.0:8080   │ http://localhost:4000/firestore │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Database       │ localhost:9000 │ http://localhost:4000/database  │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Pub/Sub        │ 0.0.0.0:8085   │ n/a                             │
├────────────────┼────────────────┼─────────────────────────────────┤
│ Storage        │ 0.0.0.0:9199   │ http://localhost:4000/storage   │
└────────────────┴────────────────┴─────────────────────────────────┘
  Emulator Hub running at localhost:4400
  Other reserved ports: 4500

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions