0

From my understanding, I should be able to mount a secret file to a Google Cloud Run service and be able to read the file later on. However, I keep getting an error: [Error: EISDIR: illegal operation on a directory, read]. I've already tried changing the service account to have the Secret Manager Secret Accessor permission, but that didn't work either

Any pointers for how I could solve this?

Example of how I'm going about this:

<< in Google Cloud Run Service setup: set Secrets mount path to "/run/secrets/mySecret"

<< in config file that has path to secret

{
   mySecretPath: "/run/secrets/mySecret"
}

<< file reading function

import {readFile} from 'fs/promise'
async function readMySecret(path) {
  return await readFile(path, {
     encoding: "utf8"
   }
}
Brandon-Perry
  • 366
  • 4
  • 18

1 Answers1

1

The way you've set it up, the mount path is a directory. There are files within it for each version. Try reading /run/secrets/mySecret/latest intead.

Ben K
  • 344
  • 2
  • 5