Not to be confused with React Server
Functions; while they serve similar purposes,
Attio server functions have different requirements and therefore do not follow the RSC protocol.
The globals available to you are listed in Available Globals.
.server.ts
suffix. The file must export
a default async function
, which will serve as the
entry point for the server function. You can then import and call this function within the client
code.
Here is an example of using a server function to make
a request
to Outreach on behalf of a user.
TypeScript
addToSequence()
function can be called from your client side code like:
TypeScript
Whatever you pass to or return from a server function will go through
JSON.stringify(JSON.parse(...))
.try/catch
or .catch
promise chaining.
Debugging
To check output ofconsole.log()
inside the server functions, open the Logs tab for your app in the Developer Portal.