Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

146
Vistas
How to change file's metadata in Google Cloud Storage with Reactjs

Im trying to update the metadata in Google Cloud Storage with Reactjs. I tried the exact code in this link How to change file's metadata in Google Cloud Storage with Node.js and it wont work on my end.

I also tried to import the ff:

import {Storage} from '@google-cloud/storage'

These are the error messages I am getting:

(1)

GET http://metadata.google.internal./computeMetadata/v1/instance net::ERR_NAME_NOT_RESOLVED

(2)

Uncaught (in promise) TypeError: Unexpected error determining execution environment:process.emitWarning is not a function

Here is my code

const storage = new Storage();

const file = storage
        .bucket(bucketName)
        .file(filename)

// Get the file's metadata 
const [metadata] = await file.getMetadata()

// update metadata    
file.setMetadata(metadata.metadata.example='updated')
almost 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The @google-cloud/storage package is meant to be used on server side and not a web app. You can use a Cloud Function that'll update the metadata based on the data from client. For example:

const functions = require('@google-cloud/functions-framework');

functions.http('updateMetadata', async (req, res) => {
  const { metadata, filename } = req.body;

  const file = storage
        .bucket(bucketName)
        .file(filename)

  // update metadata

  res.json({ message: "File updated" })
});

If you are using Firebase Storage, then you can also Firebase Client SDK to update metadata from client side.

almost 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda