Functions
Create a function, write and deploy its code, and call it over HTTP with environment variables and access policies.
A function is a piece of code that runs when it is called, without a server for you to manage. You create and manage functions in Super FunctionsFunctions.
Choose a prefix
- Open Super FunctionsFunctions.
- Pick a prefix in the Select Prefix list at the top.
The list shows each function's Function name, Runtime, Memory, Timeout and Created date. An empty table means the prefix has no functions yet.
Create a function
- Pick a prefix in Select Prefix at the top of the screen first, so the list can refresh after you create the function.
- Click Create Function.
- Fill in the left side of the form (details below). Use the same prefix as at the top of the screen.
- Write or paste your code in Function Code on the right.
- Click Create Function.
You'll see "Successfully created service", the dialog closes and the list reloads.
Check that the function appears in the list: the console can show the success message even when the request was rejected. If it isn't there, or you see "Unable to create service", the function wasn't created: try again, or check your role in this prefix (roles).
The form
| Field | What to enter |
|---|---|
| Select Prefix | The prefix the function belongs to. Required. |
| Region | Where the function runs. |
| Function Name | A name you'll recognise, e.g. hello-world. Required. |
| Runtime | Python 3.11 or Node.js 20. Required. |
| Memory (MB) | Memory for each run. Starts at 128. |
| Timeout (Seconds) | How long a run may take before it is stopped. Starts at 30. |
| Handler | The name of the function in your code that is called. Starts at handler. |
The editor starts with a Python example:
def handler(req):
return {"hello": "world"}
The example and the editor's colours are for Python, whatever runtime you pick. For Node.js 20, replace the example with your JavaScript and make sure the function name matches Handler.
Open a function
Click ActionOpen on a function. Its workspace opens full screen, with the tabs Code, Triggers, Environment and Security / Policy, and a Deploy button at the top. Close it with ✕.
The Invoke panel is a preview: it shows your Test Payload as the Response without running the function, and Metrics aren't collected yet. To test the function for real, call its trigger URL.
You can't rename or delete a function from the console.
Edit and deploy the code
Saving and deploying are two separate steps. Your callers keep getting the last deployed code until you deploy again.
- Open the function and go to the Code tab. The current code loads automatically.
- Make your changes.
- Click Save Code. You'll see "Code saved successfully".
- Click Deploy at the top. You'll see "Deployment started".
"Deployment started" only means the request was sent. The console doesn't show deployment progress or errors, so give it a moment, then call the function to check the new code is live.
If you see an error instead of "Code saved successfully", your changes weren't saved: copy them somewhere safe, then try again. If you see "Unable to deploy function" or another message after Deploy, the deployment didn't start: check the message, fix the code and deploy again.
Call it over HTTP
An HTTP trigger gives your function a web address. Create a policy first if you want to restrict who can call it.
- Open the function and go to the Triggers tab.
- Click Add Trigger.
- Set Trigger Type to HTTP.
- Pick the Method: GET, POST, PUT, PATCH or DELETE.
- Type the Path, for example
/users. - Optional: pick one or more policies in Policies. Each one is added to the table below; click Remove to take one off.
- Click Create Trigger.
You'll see "Trigger created successfully" and a card for the trigger appears. The card shows the method, path, policies, a status badge (Active or Disabled) and the trigger's URL.
To call the function, send a request with the chosen method to the URL shown in the Triggers tab.
Copy URL copies the address without the path. Add the path (for example /users) to the end yourself, or copy the full URL from the card.
Delete a trigger
Delete on a trigger card removes it at once. Anyone using its URL gets an error from then on. A new trigger gets a new URL.
Click Delete on the card. You'll see "Trigger deleted".
Environment variables
Use environment variables for settings your code reads at run time, so you can change them without editing the code.
- Open the function and go to the Environment tab.
- Click Add Variable.
- Type the Key and the Value.
- Click Save.
You'll see "Environment variable added" and the table reloads. Check that the variable is there: if you left Key empty, the message still appears but nothing is added.
To remove a variable, click Delete on its row and confirm. You'll see "Environment variable deleted". The table doesn't update by itself: close the workspace and open it again to see the change.
If your code doesn't see a new or changed value, click Deploy again.
Anyone who can open the function can read its variables. Don't store passwords or keys you can't afford to share with them.
Security and policies
A policy controls who can call an HTTP trigger. Each policy has an API key, generated for you, and an optional list of IP addresses that are allowed to call.
Create a policy
- Open the function and go to the Security / Policy tab.
- Click Create Policy.
- Type a Name.
- Leave Type on API Key.
- Optional: under IP Whitelist, type an IP address (for example
1.1.1.1) and click Add. Repeat for each address. Click Remove to take one off. - Click Create Policy.
You'll see "Policy created successfully". The policy appears with its type and status (Active or Disabled). Then attach it to a trigger in Policies when you add the trigger.
The IP addresses aren't checked as you type them. Check each one carefully: a mistyped address won't be able to call.
See the API key
Click Open on a policy. The Policy Details dialog shows the name, type, status, API Key and the allowed IPs. Click Copy to copy the key, and give it only to the people or systems that should call the function.
Change or delete a policy
- Change: click Edit, make your changes and click Update Policy. You'll see "Policy updated successfully".
- Delete: click Delete. You'll see "Policy deleted successfully".
The policy is removed as soon as you click Delete, and its API key stops working. Check that no trigger still needs it.
Troubleshooting
- "Please select prefix", "Please enter service name" or "Please select runtime". Fill in that field in the create form.
- My new function isn't in the list. It was created under a different prefix. Switch the prefix at the top.
- The code editor is empty or doesn't appear. Reload the page. If it still doesn't appear, contact support.
- My change doesn't show when I call the function. Click Save Code, then Deploy.
- "Policy not found". The policy was deleted by someone else. Close the dialog and reopen the workspace.