question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting metadata seems really difficult to reason with.

See original GitHub issue

I was just trying to set the metadata to files and frankly couldn’t figure out what was going on. I’m still not 100% but I think this invalid:

file.setMetadata({
  'example-key': 'example-value',
});

Instead it’s meant to be:

file.setMetadata({
  metadata: {
    'example-key': 'example-value',
  }
});

Reason being that custom metadata has to moved out of the top level set of metadata values.

If this is the case, I would love two changes made to the API to make this easy to reason with:

  1. Enforce a strict check on the metadata value such that custom values cannot be used on the top level metadata object.
  2. Bit of a stretch but I would like it Add a setCustomMetadata() method to avoid this weirdness around wrapping metadata with a metadata key.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
repentsinnercommented, Aug 20, 2019

I ran into this recently, and would suggest that rather than changing the APIs maybe just add an explicit user metadata sample for any of the contexts that support it? It’s very loosely hinted at in some of the existing samples such as https://github.com/googleapis/nodejs-storage/blob/master/samples/files.js#L257

The docs do touch on this as well (https://googleapis.dev/nodejs/storage/latest/File.html#setMetadata), but don’t explicitly call out that the nested nature of the term ‘metadata’ might be a gotcha for those unfamiliar with this. Perhaps some clearer wording to suggest that metadata.metadata can be considered as metadata.user_metadata or metadata.context_metadata, rather than GCS-specific metadata would help?

I’d also suggest that this file.js example that is embedded in the docs could be included in the samples directory for those of us who read docs as a last resort 😃 This code most clearly illustrates the difference between reserved GCS properties and custom properties.

0reactions
stephenpluspluscommented, Aug 16, 2019

It’s rare a complaint for this comes up, and since we’re stuck for ideas, maybe it’s just an uncommon, short-lived pain point?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ten Most Common Metadata Errors - WV GIS Technical Center
Metadata experts have joined together to compile this list of common errors that are typically made when people create metadata records.
Read more >
Fixing common Metadata API errors for more ... - YouTube
One of the most time-consuming frustrations you'll face as a Salesforce admin, developer, or architect are deployments that repeatedly fail.
Read more >
How to display full metadata in ArcGIS Online open data
I have gone through the metadata setting on our organization's setting page and none of the options appears allow the display of the...
Read more >
Common Mistakes Companies Make with Metadata ...
Difficulty in accessing the metadata repository : If data access and retrieval requires too much effort, it defeats the purpose of metadata management....
Read more >
Metadata Matters: Connecting People and Information
Metadata provides a means of indexing, accessing, preserving, and discovering ... database into a single ranked result set is difficult and time consuming....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found