Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

281
Visualizações
How to fix Api Error: Required parameter: project in GAE with GCS

I am getting the following error when trying to connect with a Google Cloud Storage Bucket in a nodejs app based in the Google App Engine.

ApiError: Required parameter: project

   at Util.parseHttpRespBody (/workspace/node_modules/@google-cloud/common/build/src/util.js:208:38)

   at Util.handleResp (/workspace/node_modules/@google-cloud/common/build/src/util.js:149:117)

The code to connect in the server.js file is pretty straightforward:

const {Storage} = require('@google-cloud/storage');
const storage = new Storage();
storage.getBuckets().then(y => console.log(y));

Both the deployed app and storage bucket are part of the same project.

I have also created a service account for the storage bucket, which has API Keys Admin and Storage Admin roles, and API keys have been generated.

Any help would be much appreciated!

Edit:

Here is the updated code (with my project id edited):

const {Storage} = require('@google-cloud/storage');

const storage = new Storage({
  projectId: 'r@@@@@@t-t@@@h-3####9'
});

storage.getBuckets().then(y => console.log(y));

package.json dependencies:

"dependencies": {
    "@google-cloud/storage": "^5.15.3",
    "body-parser": "^1.19.0",
    "dotenv": "^10.0.0",
    "ejs": "^3.1.6",
    "express": "^4.17.1",
    "multer": "^1.4.3",
    "pg": "^8.7.1",
    "pg-hstore": "^2.3.4",
    "sequelize": "^6.6.5",
    "sequelize-cli": "^6.2.0"
  },
  "devDependencies": {
    "@types/node": "^14.6.2",
    "nodemon": "^2.0.14"
  }
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Create the client and specify the Project ID (not the project name):

const storage = new Storage({
  projectId: 'your-project-id'
});

If you want to specify the service account that you mentioned:

const storage = new Storage({
  projectId: 'your-project-id',
  keyFilename: '/path/to/service-account-key.json'
});

Documentation:

Google Cloud Storage Nodejs Client

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda