functions-framework-nodejs icon indicating copy to clipboard operation
functions-framework-nodejs copied to clipboard

Expose an invoke function

Open matthewrobertson opened this issue 3 years ago • 0 comments

Currently configuring the credentials necessary to invoke another function requires a lot of boilerplate code that is difficult to get right. We could easily expose a method in the functions framework that implements this. Proposed API:

import * as functions from '@googelcloud/functions-framework';

functions.http('Foo', (req, res) => res.send('hello!');

functions.http('Bar', async (req, res) => {
  const result = await functions.invoke('my-project', 'Foo', {some: 'payload'});
  res.send(result);
});

matthewrobertson avatar Oct 26 '21 00:10 matthewrobertson