Home > other >  Trying to load external resources on Firebase function
Trying to load external resources on Firebase function

Time:08-21

I want to upload a YAML file during the deployment and use it.

How can I do this on Firebase functions? I added the file, but when I try to read it the file does not exist

await fs.readFile(path.resolve('./manifest.yaml'), 'utf-8')

Error: ENOENT: no such file or directory, open '/workspace/manifest.yaml'

My question is: Is it possible to deploy additional files on Firebase Functions?

enter image description here

CodePudding user response:

Paths to deployed files in Cloud Functions are not relative to the source code file where you want to load them. They always going to be relative to the root folder of the deployment. That means the manifest file is more likely located at "./lib/src/triggers/manifest.yaml" if "functions" is your project deployment root.

  • Related