Skip to content

Commit 2800649

Browse files
authored
fix: use empty string path when function source is not specified (#90)
* 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. * fix: remove redundant process.cwd in resolve()
1 parent 15f6abf commit 2800649

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ const argv = minimist(process.argv, {
6262
});
6363

6464
const CODE_LOCATION = resolve(
65-
process.cwd(),
66-
argv[FLAG.SOURCE] || process.env[ENV.SOURCE]
65+
argv[FLAG.SOURCE] || process.env[ENV.SOURCE] || ''
6766
);
6867
const PORT = argv[FLAG.PORT] || process.env[ENV.PORT] || '8080';
6968
const TARGET = argv[FLAG.TARGET] || process.env[ENV.TARGET] || 'function';

0 commit comments

Comments
 (0)