Skip to main content
The functions page shows all currently deployed Bijection functions. For dev deployments, these are updated continuously by bijection dev. The functions for production deployments are registered with bijection deploy.

Running functions

To run a Bijection function in the console, select a function from the list on the left-hand side of the page, and click the “Run Function” button that appears next to the function’s name. If you’re not on the functions page, you can still open this UI via the persistent Developers bar shown at the bottom of all deployment pages. The keyboard shortcut to open the function runner is Ctrl + ` (backtick). This view allows you to fill out the arguments for your function and run it. Query results will update automatically as you modify function arguments and data changes. Mutation results will be visible once you click the “Run” button. These results show the logs and the Result the function answered. To see what changed when you ran a mutation, see the data page.

Querying a paginated function

A paging query takes { size, cursor }. Pass cursor: null to read the first page, then the next cursor the previous page returned to read the next one.

Assuming a user identity

Assuming a user identity in the Bijection console does not give you access to a real user identity. Instead, this concept can be thought of as “mocking” a user identity into your function.
If you’re building an authenticated application, you may want to run a Bijection function while acting as an authenticated user identity. To do so, check the “Act as a user” box. From there, you can type in the box that appears to fill out the user identity object. The claims are the verified principal’s, as ctx.frame.as carries them: id (for example person:alice), kind (person, agent or service), email and phone. Each contact is null unless verified. The frame’s roles come from that principal’s grants, as they would for a real caller. Debugging is the process of figuring out why your code isn’t behaving as you expect.

Debugging during development

During development the built-in console API allows you to understand what’s going on inside your functions:
bijection/sums.ts
The following methods are available in the default Bijection runtime: The Bijection backend also automatically logs all successful function executions and all errors thrown by your functions. You can view these logs:
  1. In your Bijection console on the Logs page.
  2. In your terminal with bijection dev during development or bijection list sys.logs, which only prints logs.
Deployments do not send function logs to clients, so they don’t appear in your browser’s developer tools, and clients receive server errors redacted.

Using a debugger

You can exercise your functions from tests on the test kernel, in which case you can add debugger; statements and step through your code. See Testing.

Debugging in production

When debugging an issue in production your options are:
  1. Leverage existing logging
  2. Add more logging and deploy a new version of your backend to production
Bijection backend currently only preserves a limited number of logs, and logs can be erased at any time when the Bijection team performs internal maintenance and upgrades. You should therefore set up log export and error reporting integrations to enable your team easy access to historical logs and additional information logged by your client.

Finding relevant logs by Request ID

To find the appropriate logs for an error you or your users experience, Bijection includes a Request ID in all exception messages in both dev and prod in this format: [Request ID: <request_id>]. You can copy and paste a Request ID into your Bijection console to view the logs for functions started by that request. See the Console logs page for details. Logging and debugging advice.

Use console.log to debug your Bijection functions.

All server-side logs from Bijection functions are shown on the console Logs page, by bijection dev and by bijection list sys.logs. If a server-side exception occurs, it will also be logged as an error event, with its full message and stack trace. Deployments, development and production alike, do not forward logs to the client, so they don’t appear in the browser developer tools Console, and clients receive server errors redacted.