Overview
Browser module for running browser automation from your backend. This module creates remote browser sessions that you can control with a Chrome DevTools Protocol (CDP) client library such as Playwright or Puppeteer. Base44 doesn’t store browser state, so each session is independent.Authentication modes
This module is only available to use with a client in service role authentication mode (base44.asServiceRole.browser), which means it can only be used in backend environments.
Methods
getSession()
getSession(Creates a new remote browser session and returns its connection details. Each call creates a fresh session, which uses credits from the workspace that owns the app. Each session is billed by the minute until it ends. An open session keeps running until its timeout expires. When you’re done, calloptions?):Promise<BrowserSession>
end() on the session. To end it from a different request, use endSession().
Parameters
BrowserSessionOptions
Optional session settings.
Properties
Properties
boolean
Whether Base44’s browser provider records the session and keeps its diagnostic logs.You can’t retrieve the recordings or logs through the SDK. Set this to
false when the session shows sensitive data that shouldn’t be recorded. Defaults to true.number
Maximum lifetime of the session, in whole seconds.The session ends when the timeout expires, even if it’s still in use. Base44 clamps the value to between
60 and 900 seconds. Defaults to 300.Returns
BrowserSession
Promise resolving to the new browser session. Rejects with a Base44Error whose code is one of the values under Throws.
Properties
Properties
string
requerido
Opaque session identifier issued to your app.Pass it unchanged to
endSession() to end the session from a different request.string
requerido
Signed WebSocket URL for connecting to the browser over the Chrome DevTools Protocol (CDP).Treat the complete URL as a credential. Don’t log it or send it to the frontend.
"browser" | "page"
requerido
Scope of the CDP connection.
'browser': The socket controls the whole browser.'page': The socket controls a single page.
string
ISO 8601 timestamp when the connection URL expires. Omitted when the provider doesn’t expose it.
string
ISO 8601 timestamp when the browser session expires. Omitted when the provider doesn’t expose it.
() => Promise<void>
requerido
Ends the session. Equivalent to calling
endSession() with this session’s ID.Throws
insufficient_credits: The workspace is out of credits.rate_limited: You created more than 100 sessions in the last minute.browser_capacity_exceeded: Browser capacity is temporarily unavailable.
Examples
endSession()
endSession(Ends a browser session created by your app. Use this when the session was created in a different request. Otherwise callsessionId):Promise<void>
end() on the session returned by getSession(). Ending a session that has already ended succeeds, so it’s safe to call more than once.
Parameters
string
requerido
The
sessionId returned by getSession().Returns
Promise<void>
Promise that resolves when the session has ended. Rejects with a Base44Error whose code is one of the values under Throws.
Throws
browser_session_not_found: The session ID wasn’t issued to your app.