Skip to content

Commit 2d1aea9

Browse files
committed
fix: use empty string path when --source flag and FUNCTION_SOURCE env var are not specified
I removed '/' from CODE_LOCATION that set the default function directory to root in commit #77. This causes this error in 1.3.0, ``` npx @google-cloud/functions-framework --target=helloWorld The "path" argument must be of type string. Received type undefined ``` When --source flag and FUNCTION_SOURCE env var are not specified, one of the 'path' arguments in resolve() is undefined. This causes the error above. I've added empty string as an argument in the case above. This should fix the bug.
1 parent 15f6abf commit 2d1aea9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const argv = minimist(process.argv, {
6363

6464
const CODE_LOCATION = resolve(
6565
process.cwd(),
66-
argv[FLAG.SOURCE] || process.env[ENV.SOURCE]
66+
argv[FLAG.SOURCE] || process.env[ENV.SOURCE] || ''
6767
);
6868
const PORT = argv[FLAG.PORT] || process.env[ENV.PORT] || '8080';
6969
const TARGET = argv[FLAG.TARGET] || process.env[ENV.TARGET] || 'function';

0 commit comments

Comments
 (0)