AWS Secrets Manager: Credential is missing

43 Views Asked by At

I'm trying to access private information with my React application from Secrets Manager but when I do I get a credentials missing error.

I do have the aws SDK installed and I've tried setting up and IAM account with all privileges but it hasn't solved the problem. I will greatly appreciate your help, especially because my description of the problem is lacking detail. Below is the code that is the source of the error, the error is thrown at line 19 (response = await client.send).

import { getAuth } from "firebase/auth";
import { initializeApp } from "firebase/app";
import {
  SecretsManagerClient,
  GetSecretValueCommand,
} from "@aws-sdk/client-secrets-manager";

const secret_name = "deckstatistics/firebase";

const initializeFirebase = async () => {
  const client = new SecretsManagerClient({
    region: "us-west-2",
  });

  let response;
  console.error(client.config.credentials);

  try {
    response = await client.send(
      new GetSecretValueCommand({
        SecretId: secret_name,
        VersionStage: "AWSCURRENT",
      })
    );
  } catch (error) {
    console.error(error);
    throw error;
  }

  const secret = response.SecretString;

  console.log(secret);
0

There are 0 best solutions below