Skip to content

Commit

Permalink
fix background triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcnellis committed May 13, 2021
1 parent e5c119e commit 79bd13d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/emulator/functionsEmulator.ts
Expand Up @@ -222,10 +222,8 @@ export class FunctionsEmulator implements EmulatorInstance {
const httpsFunctionRoutes = [httpsFunctionRoute, `${httpsFunctionRoute}/*`];

const backgroundHandler: express.RequestHandler = (req, res) => {
const triggerName = req.params.trigger_name;
const region = req.params.region;
const triggerId = req.params.trigger_name;
const projectId = req.params.project_id;
const triggerId = `${region}-${triggerName}`;

const reqBody = (req as RequestWithRawBody).rawBody;
const proto = JSON.parse(reqBody.toString());
Expand Down Expand Up @@ -1094,7 +1092,7 @@ export class FunctionsEmulator implements EmulatorInstance {
// req.url = /:projectId/:region/:trigger_name/*
const url = new URL(`${req.protocol}://${req.hostname}${req.url}`);
const path = `${url.pathname}${url.search}`.replace(
new RegExp(`\/${this.args.projectId}\/[^\/]*\/${triggerId}\/?`),
new RegExp(`\/${this.args.projectId}\/[^\/]*\/${triggerName}\/?`),
"/"
);

Expand Down

0 comments on commit 79bd13d

Please sign in to comment.