The short answer
HubSpot's native custom code action must finish within 20 seconds and can use up to 128 MB of memory. It also caps included properties at 50, caps combined secret values at 1,000 characters, and runs only the libraries HubSpot lists. A test applies changes to the record you select.
HubSpot documents three hard limits for the native custom code action: it must finish within 20 seconds, it can use up to 128 MB of memory, and exceeding either limit returns an error. Time and memory fail differently. A request that waits uses the clock. A file or a large object uses memory. Treat the error you actually received as the one to debug.
The action is available on Data Hub Professional and Enterprise. These runtime limits are separate from that subscription. Buying the action does not raise them.
Inputs, outputs, and secrets
You can include up to 50 properties. Each property is added once and needs a unique name in the code. Outputs you want a later step to use have to be declared on the action, with a type and a name. An undeclared value shows up in the test warning and is not available to Edit records.
Secrets hold tokens, not CRM fields. When an action uses multiple secrets, HubSpot says the combined secret values must not exceed 1,000 characters. A private app token still needs the scopes for whatever the code reads. On a test account, HubSpot requires OAuth or a private app token. A developer API key is rejected.
Libraries you cannot add
Node.js and Python each have a published library list, loaded with require() or an import. There is no install step for an arbitrary npm or pip package. If the package is absent from the list, the native action cannot load it. npm packages in workflows is the check to make before rewriting a library by hand. Python on this action is still documented as a beta: Python in HubSpot workflows.
A test writes the record
Testing runs only that action, not the rest of the workflow. HubSpot states that the code runs and any changes apply to the selected record. Create a record for tests if the action creates, updates, merges, or deletes data.
The test log reports status, declared outputs, and how much memory and time the run used. That log is the first place to separate a 20-second timeout from a memory error. The timeout message is covered in the 20-second timeout.
Rate limits and retries
You can turn on a rate limit for the action: a maximum number of executions per seconds, minutes, or hours. It is off by default. When it pauses the action, HubSpot also holds the following steps, and the log says the action was paused to stay within the configured rate limit.
HubSpot API calls from the code still count against HubSpot’s API limits. For Node.js, HubSpot says to throw a rate-limit error from catch if you want a retry. For Python, raise it from except. If the failure is a rate limit, a 429, or a 5xx from axios or @hubspot/api-client, HubSpot documents reattempts for up to three days, starting one minute later and backing off to at most eight hours. That retry is not a reason to skip idempotency. An earlier attempt may already have written the record.
When the limit is the job
A short formatting rule or a single lookup fits inside 20 seconds and the listed libraries. A paginated sync, a PDF, or a package outside the list does not become possible by retrying the same action. HubSpot custom code actions explains the native step. Custom code without Data Hub explains a connected-app action, which is a different runtime with its own limits, not a switch that removes HubSpot’s API quotas.
Sources and references
Source documentation checked for this update. Availability can vary by subscription and account.