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 theResult 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
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, asctx.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-inconsole API allows you to understand what’s
going on inside your functions:
bijection/sums.ts
- Logging values, with a specified severity level:
console.logconsole.infoconsole.warnconsole.errorconsole.debug
- Logging with a stack trace:
- Measuring execution time:
- In your Bijection console on the Logs page.
- In your terminal with
bijection devduring development orbijection list sys.logs, which only prints logs.
Using a debugger
You can exercise your functions from tests on the test kernel, in which case you can adddebugger; statements and step through your code. See
Testing.
Debugging in production
When debugging an issue in production your options are:- Leverage existing logging
- Add more logging and deploy a new version of your backend to production
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.