Skip to content

Call a function

View as Markdown

Call a function over its public HTTPS URL, from the command line with curl or from MyAccount with Post Request. The URL has the form https://<function-name>-<suffix>.serverless.e2enetworks.net/. <function-name> is the name you gave the function. The suffix is the same for every function in your account.

You need a function whose Status reads Running. To copy its URL, select the function in the Functions list and open the Info tab below the list. The function’s own page shows the URL too.

A GET request returns the function’s response:

curl https://<function-name>-<suffix>.serverless.e2enetworks.net/

A POST request with a JSON body does the same:

curl -X POST -H "Content-Type: application/json" -d '{"key": "value"}' \
https://<function-name>-<suffix>.serverless.e2enetworks.net/

Replace the address with your function’s URL. The response is whatever the handler returns.

  1. In Compute > Functions, click the function’s name to open its page.
  2. Click Try. The Enter Arguments panel opens.
  3. In User Input, enter the JSON arguments for the call.
  4. Click Post Request.

The response shows in Output, with Runtime Logs beside it.

In the Python and Node.js HTTP runtimes, a function answers cross-origin requests from any origin by default. The response carries Access-Control-Allow-Origin: *.

In the same runtimes, a function accepts JSON bodies up to 10 MB by default. Another content type, such as text/plain, gets HTTP 415. A larger body gets HTTP 413. You can change these defaults, and which origins a browser can call it from, in the function’s init function. See Requests and responses.

In the FastAPI, Flask, and Express runtimes, your app decides what it accepts, and the init function does not apply. See FastAPI, Flask, and Express runtimes.

You will see the handler’s response to your request, either in the terminal for curl or in Output for Post Request. The Invocation Count on the Info tab and in the Monitoring chart counts each call.

If the call returns an error status, or Output says the function provided no response, see Troubleshooting Functions.