简体   繁体   中英

Trying to load external resources on Firebase function

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?

在此处输入图像描述

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM