unionlabs/union · error · Error
No Aptos RPC URL found
Error message
No Aptos RPC URL found
What it means
Thrown by getAptosClient in the Union TypeScript SDK when building an Aptos client with authAccess "key". In that mode the SDK expects a viem-style transport function and extracts the RPC URL via transport({}).value?.url; if that call yields no URL, no AptosConfig/fullnode can be constructed, so client creation aborts. It is a configuration error that happens before any network call to Aptos is made.
Source
Thrown at typescript-sdk/src/aptos/client.ts:60
): Promise<{ authAccess: "key"; aptos: Aptos; signer: AptosAccount }>
// async function getAptosClient(
// parameters: AptosClientParameters & { authAccess: "wallet" }
// ): Promise<{ authAccess: "wallet"; aptos: Aptos; signer: AptosBrowserWallet }>
async function getAptosClient(
parameters: AptosClientParameters & { authAccess: AuthAccess },
): Promise<
| { authAccess: "key"; aptos: Aptos; signer: AptosAccount }
| { authAccess: "wallet"; aptos: Aptos; signer: AptosBrowserWallet }
> {
if (parameters.authAccess === "key") {
if (typeof parameters.transport !== "function") {
throw new Error("Invalid Aptos transport")
}
const rpcUrl = parameters.transport({}).value?.url
if (!rpcUrl) {
throw new Error("No Aptos RPC URL found")
}
const config = new AptosConfig({
fullnode: rpcUrl,
network: Network.CUSTOM,
})
return {
authAccess: "key",
aptos: new Aptos(config),
signer: parameters.account as AptosAccount,
}
}
if (parameters.authAccess === "wallet") {
if (typeof parameters.transport !== "object") {
throw new Error("Invalid Aptos transport")
}
const networkInfo = await parameters.transport.getNetwork()
const network = networkInfo.name.toLowerCase() === "mainnet" ? Network.MAINNET : Network.TESTNETView on GitHub (pinned to 031785bb6d)
Solutions
- Pass a viem-style transport created with http(), e.g. transport: http("https://fullnode.mainnet.aptoslabs.com/v1")
- Confirm authAccess is "key" only when you want key-based signing; pair it with an account, and use the wallet object (not a transport function) for authAccess "wallet"
- If using a custom transport, make sure calling it returns an object with value: { url: <fullnode url> }
- Verify the fullnode URL is a valid Aptos REST endpoint (usually ends with /v1)
Example fix
// before
const client = createUnionClient({
chainId: "aptos-1",
authAccess: "key",
account: aptosAccount,
transport: "https://fullnode.mainnet.aptoslabs.com/v1",
})
// after
import { http } from "viem"
const client = createUnionClient({
chainId: "aptos-1",
authAccess: "key",
account: aptosAccount,
transport: http("https://fullnode.mainnet.aptoslabs.com/v1"),
}) Defensive patterns
Strategy: validation
Validate before calling
const transport = http("https://fullnode.mainnet.aptoslabs.com/v1")
const probe = typeof transport === "function" ? transport({}) : undefined
const rpcUrl = probe?.value?.url
if (!rpcUrl) {
throw new Error("transport must be http(url) so transport({}).value.url is set")
}
const client = createUnionClient({ chainId: "aptos-1", authAccess: "key", account, transport }) Type guard
const isKeyTransportWithUrl = (
t: unknown,
): t is () => { value: { url: string } } =>
typeof t === "function" && Boolean((t as any)({})?.value?.url) Try / catch
try {
const client = createUnionClient(params)
} catch (error) {
if (error instanceof Error && error.message === "No Aptos RPC URL found") {
// fix transport to http(fullnodeUrl) and surface a config hint
}
throw error
} Prevention
- Always construct Aptos key-mode transports with http(<fullnode url ending in /v1>)
- Keep authAccess and transport kind paired: "key" -> function, "wallet" -> wallet object
- Centralize client creation in one factory so the transport shape is validated once
When it happens
Trigger: Calling createUnionClient({ chainId: <aptos chain id>, authAccess: "key", transport }) where transport is a function but transport({}).value?.url is undefined or empty. Typical causes: passing a plain URL string or an already-invoked transport object instead of http(url), using a custom transport whose value lacks a url field, or reusing a transport built for a different chain shape.
Common situations: Passing transport: "https://fullnode.mainnet.aptoslabs.com/v1" instead of http("https://..."); copying a Cosmos/EVM example but swapping only the chainId; a transport factory that returns { config } without { value: { url } }; upgrading viem/SDK versions where the transport return shape changed.
Related errors
- hash not found
- Invalid Aptos transport
- waiting for transaction failed
- simulation result not found
- Transaction failed: ${transaction?.vm_status} - ${JSON.strin
AI-assisted analysis of unionlabs/union@031785bb6d (2026-08-16).
Data as JSON: /api/errors/5b03913e097e8b80.
Report an issue: GitHub.