Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with Python Functions when path has spaces #5858

Merged
merged 2 commits into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Attempt to fix issue with Python Functions when path has spaces
  • Loading branch information
aalej committed May 17, 2023
commit 4346b8ff3dd44224cea7a71b253c71e8d361a264
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes an issue running `firebase emulators:start` when Python Cloud Functions directory path has spaces. (#5854)
aalej marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion src/deploy/functions/runtimes/python/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
}
const runtime = context.runtime ? context.runtime : LATEST_VERSION;
if (!runtimes.isValidRuntime(runtime)) {
throw new FirebaseError(`Runtime ${runtime} is not a valid Python runtime`);

Check warning on line 36 in src/deploy/functions/runtimes/python/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Invalid type "never" of template literal expression
}
return Promise.resolve(new Delegate(context.projectId, context.sourceDir, runtime));

Check warning on line 38 in src/deploy/functions/runtimes/python/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

'Delegate' was used before it was defined
}

/**
Expand Down Expand Up @@ -138,13 +138,13 @@
return Promise.resolve();
}

async serveAdmin(port: number, envs: backend.EnvironmentVariables) {

Check warning on line 141 in src/deploy/functions/runtimes/python/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Missing return type on function
const modulesDir = await this.modulesDir();
const envWithAdminPort = {
...envs,
ADMIN_PORT: port.toString(),
};
const args = [this.bin, path.join(modulesDir, "private", "serving.py")];
const args = [this.bin, `"${path.join(modulesDir, "private", "serving.py")}"`];
const stdout: string[] = [];
const stderr: string[] = [];
logger.debug(
Expand Down Expand Up @@ -190,10 +190,10 @@
const { killProcess, stderr } = await this.serveAdmin(adminPort, envs);
try {
discovered = await discovery.detectFromPort(adminPort, this.projectId, this.runtime);
} catch (e: any) {

Check warning on line 193 in src/deploy/functions/runtimes/python/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type
logLabeledWarning(
"functions",
`Failed to detect functions from source ${e}.\nstderr:${stderr.join("\n")}`

Check warning on line 196 in src/deploy/functions/runtimes/python/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Invalid type "any" of template literal expression
);
throw e;
} finally {
Expand Down