Skip to content

Storage emulator custom metadata clear via setting null returns string 'null' for property #3385

@mikehardy

Description

@mikehardy

[REQUIRED] Environment info

Hi there!

firebase-tools: 9.11.0

Platform: macOS 11.3.1

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

  1. start emulator
  2. configure client to use emulator, in this case I'm implementing storage.useEmulator support for react-native-firebase but we emulate firebase-js-sdk APIs so then run this code:
      const storageReference = firebase.storage().ref('testFile.txt');
      const metadata = await storageReference.updateMetadata({
        contentType: 'text/plain',
        customMetadata: {
          removeMe: 'please',
        },
      });

      metadata.customMetadata.removeMe.should.equal('please');

      const metadataAfterRemove = await storageReference.updateMetadata({
        contentType: 'text/plain',
        customMetadata: {
          removeMe: null,
        },
      });

      // FIXME this is failing
      console.error(JSON.stringify(metadataAfterRemove));
      should.equal(metadataAfterRemove.customMetadata.removeMe, undefined);

[REQUIRED] Expected behavior

customMetadata.removeMe should be undefined in javascript terms at that point?

[REQUIRED] Actual behavior

customMetadata.removeMe is the string null:

here's a paste of that console.error statement:

{"contentType":"text/plain","contentEncoding":"identity","contentDisposition":"inline","updated":"2021-05-18T21:58:16Z","timeCreated":"2021-05-18T21:55:47Z","contentLanguage":null,"generation":"1621392947873","name":"writeOnly.txt","size":10,"fullPath":"writeOnly.txt","customMetadata":{"removeMe":"null"},"metageneration":"1","cacheControl":null,"md5Hash":"o8152dbQWHKzkt84nfUEKg==","bucket":"react-native-firebase-testing.appspot.com"}

I'll try to put a commit hash in later once my storage emulator work is public

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions