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

@azure/storage-blob - containerClient.listBlobsFlat() metadata property is empty #12708

Closed
5 tasks
diberry opened this issue Nov 29, 2020 · 9 comments
Closed
5 tasks
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Docs feature-request This issue requires a new behavior in the product in order be resolved. Storage Storage Service (Queues, Blobs, Files)

Comments

@diberry
Copy link
Contributor

diberry commented Nov 29, 2020

  • Package Name: containerClient.listBlobsFlat()
  • Package Version: 12.3.0
  • Operating system: windows 10 internal
  • nodejs
    • version: v10.15.3
  • browser
    • name/version: Chrome Version 86.0.4240.198 (Official Build) (64-bit)
  • typescript
    • version:3.7.5
  • Is the bug related to documentation in

Describe the bug
Metadata set on blob isn't returned as part of blobInfo in ListBlobsFlat. The Metadata property is returned, it just doesn't have the data.

To Reproduce
Steps to reproduce the behavior:

  1. Create blob in FrontEnd React (create-react-app) with blobClient.uploadBrowserData(file, options);
  2. Read returned results for url property which is the url for the blob
  3. Set metadata on blob with url - blobClient.setMetadata({ urlAtCreation: blobClient.url });
  4. Verify blob has metadata set with local Azure Storage Explorer
  5. List blobs in container with containerClient.listBlobsFlat() - metadata property returned but is empty

Expected behavior
I expect if I set the metadata for a blob, and I can see the metadata in the Storage Explorer for that blob, then it is the same metadata that is returned with listBlobsFlat. Not sure why metadata is a string when I expect an object.

Screenshots
2 screenshots from react app debugging issue where metadata is returned as a string. 1 screenshot of storage explorer with metadata property I expect to see in code.

1129-storage-blob-metadata-1
1129-storage-blob-metadata-3
1129-storage-blob-metadata-2

Additional context
I didn't add any additional security that would indicate I don't want metadata returned in the list.

@ghost ghost added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 29, 2020
@ramya-rao-a ramya-rao-a added Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files) labels Nov 30, 2020
@ghost ghost removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Nov 30, 2020
@ramya-rao-a ramya-rao-a added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 30, 2020
@ljian3377
Copy link
Member

You need to set the options.includeMetadata to true for List Blob to return metadata.

@diberry
Copy link
Contributor Author

diberry commented Nov 30, 2020

@ljian3377 I see that in the docs - thank you - missed that.

@diberry
Copy link
Contributor Author

diberry commented Nov 30, 2020

@ljian3377 When I set the metadata with a property name with a capitalization, why is the property name lowercased when returned via containerclient.listBlobsFlat? I can't find the docs that indicate this casing change.

`
// set metadata
const setMetadataResults = await blobClient.setMetadata({urlAtCreation:'test'});

// get blobs - urlAtCreation is empty
for await (const blob of container.containerClient.listBlobsFlat(options)) {
  const simplifiedBlob: AppBlobInfo = {
    name: blob.name,
    createdOn: blob.properties.createdOn,
    lastModified: blob.properties.lastModified,
    etag: blob.properties.etag,
    contentLength: blob.properties.contentLength,
    contentType: blob.properties.contentType,
    blobType: blob.properties.blobType,
    url: blob.metadata['urlAtCreation']
  };

  returnedBlobUrls.push(simplifiedBlob);
}

`

image

@jeremymeng
Copy link
Member

When I set the metadata with a property name with a capitalization, why is the property name lowercased

This is unfortunate because the metadata is passed to the service via http header keys, and our http client node-fetch forces all lower cases for header key names. See related issues #4966, #8117.

We have some warnings in getProperties() and should probably add similar notes to the doc of setMetadata().

https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/storage/storage-blob/src/Clients.ts#L1481

@diberry
Copy link
Contributor Author

diberry commented Nov 30, 2020

@jeremymeng Could there be a more general statement made such as..."All modern (track 2) libraries which use node-fetch and sends data via header key names, such as Storage Blob metadata, will have lowercased property names due to a node-fetch restriction."

Or just all libraries that depend on node-fetch can assume property names of JSON will be lowercased?

@jeremymeng
Copy link
Member

"All modern (track 2) libraries which use node-fetch and sends data via header key names, such as Storage Blob metadata, will have lowercased property names due to a node-fetch restriction."

This. Only data send via http header key names are affected. Http header key values are working fine. Although Storage Blob metadata is the only impacted feature that I know so far.

@ljian3377
Copy link
Member

ljian3377 commented Dec 9, 2020

@diberry What is your suggested follow-up for this issue?

Maybe

We have some warnings in getProperties() and should probably add similar notes to the doc of setMetadata().

@ljian3377 ljian3377 added needs-author-feedback Workflow: More information is needed from author to address the issue. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Dec 9, 2020
@diberry
Copy link
Contributor Author

diberry commented Dec 9, 2020

Any storage methods that set or get headers that are lowercased need to have additional text - @jeremymeng text is fine.

All modern (track 2) libraries which use node-fetch and sends data via header key names, such as Storage Blob metadata, will have lowercased property names due to a node-fetch restriction.

@ghost ghost added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team and removed needs-author-feedback Workflow: More information is needed from author to address the issue. labels Dec 9, 2020
@ljian3377 ljian3377 added Docs and removed question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Dec 10, 2020
@ljian3377 ljian3377 added this to the Backlog milestone Dec 10, 2020
@ramya-rao-a ramya-rao-a added bug This issue requires a change to an existing behavior in the product in order to be resolved. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Jan 25, 2021
@amishra-dev amishra-dev removed the bug This issue requires a change to an existing behavior in the product in order to be resolved. label Jan 29, 2021
@ramya-rao-a ramya-rao-a added the feature-request This issue requires a new behavior in the product in order be resolved. label Feb 2, 2021
@ljian3377 ljian3377 assigned EmmaZhu and unassigned ljian3377 Feb 10, 2021
Copy link

Hi @diberry, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2024
@xirzec xirzec removed this from the Backlog milestone May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. Docs feature-request This issue requires a new behavior in the product in order be resolved. Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

No branches or pull requests

7 participants