firebase / firebase/firebase-tools

Export to dotenv fails if config is specified with empty characters in firebase functions.

Open
#7,460 1 comment 0 reactions 1 assignee Assigned to @taeold View on GitHub
api: functions reproducible type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

Export to dotenv fails if config is specified with empty characters in firebase functions.

### [REQUIRED] Environment info

**firebase-tools:**

13.13.3

**Platform:**

macOS 14.4

### [REQUIRED] Test case

```bash
$ firebase functions:config:set hoo.bar=""
$ firebase functions:config:export
```

### [REQUIRED] Steps to reproduce

```bash
$ firebase functions:config:set hoo.bar=""
$ firebase functions:config:export
```

### [REQUIRED] Expected behavior

Exported in dotenv format.

### [REQUIRED] Actual behavior

Show following error.

```
TypeError: Cannot read properties of undefined (reading 'replace')
at escape (/Users/yoshikawa/.nodebrew/node/v20.10.0/lib/node_modules/firebase-tools/lib/functions/runtimeConfigExport.js:128:14)
at /Users/yoshikawa/.nodebrew/node/v20.10.0/lib/node_modules/firebase-tools/lib/functions/runtimeConfigExport.js:131:100
at Array.map ()
at Object.toDotenvFormat (/Users/yoshikawa/.nodebrew/node/v20.10.0/lib/node_modules/firebase-tools/lib/functions/runtimeConfigExport.js:131:24)
at /Users/yoshikawa/.nodebrew/node/v20.10.0/lib/node_modules/firebase-tools/lib/commands/functions-config-export.js:110:56
at Array.map ()
at Command.actionFn (/Users/yoshikawa/.nodebrew/node/v20.10.0/lib/node_modules/firebase-tools/lib/commands/functions-config-export.js:110:28)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
```

## Pull Request

https://github.com/firebase/firebase-tools/pull/7368

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.