Skip to content

Commit

Permalink
fix function input
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuf239 committed Jun 23, 2024
1 parent 5fbec20 commit 70abbb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libs/wingsdk/src/shared-gcp/function.inflight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class FunctionClient implements IFunctionClient {
if (!res.ok) {
throw new Error(res.body);
}
return res.body ?? "";
return res.body;
} catch (error) {
throw new Error(
`Error while invoking the function ${this.functionName}:\n${
Expand Down Expand Up @@ -65,7 +65,7 @@ export class FunctionClient implements IFunctionClient {
},
},
});
return res.data as string | undefined;
return (res.data as string) || undefined;
} catch (error) {
throw new Error(
`Error while invoking the function ${this.functionName}:\n${
Expand Down
5 changes: 2 additions & 3 deletions libs/wingsdk/src/target-tf-gcp/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,8 @@ export class Function extends cloud.Function {
lines.push(" res.set('Access-Control-Allow-Methods', 'GET, POST')");

lines.push(" try {");
lines.push(
` const result = await (${inflightClient}).handle(req.body ?? "")`
);
lines.push(`
const result = await (${inflightClient}).handle(req.body || undefined)`);
lines.push(` res.send(result);`);
lines.push(` } catch (error) {`);
lines.push(` res.status(500).send(error.message);`);
Expand Down

0 comments on commit 70abbb9

Please sign in to comment.