wispfnDocs
Function SDK

WispError, storage quota errors, and the platform's limits for functions, storage and requests.

#WispError

SDK methods throw WispError for problems your code can act on — a missing required setting, an invalid key or path, a full storage quota.

import { kv, WispError } from 'wisp';

try {
  await kv.set('big', hugeValue);
} catch (err) {
  if (err instanceof WispError) return { status: 400, body: { error: err.message } };
  throw err;
}
from wisp import kv, WispError

try:
    kv.set("big", huge_value)
except WispError as e:
    return {"status": 400, "body": {"error": str(e)}}

Uncaught errors return 500 to the caller and are recorded with their stack trace in the log.

#Storage is full

When the workspace is over its storage quota with no storage credits, writes (kv.set, kv.incr, table.insert/put/update, file.write) throw a WispError whose message starts with Storage is full. Reads and deletes keep working.

#Status codes from Wisp

StatusWhen
401The project requires an API key and none, an invalid or an expired one was sent
402The workspace is out of Run credits
404No such function, or the project isn't published yet (use ?test)
405The method doesn't match the function's
429A rate limit was reached
500Your code threw an error or ran longer than the time limit (details in the log)

#Limits

LimitValue
Run time15 seconds per request
Memory256 MB
Request and response6 MB
Key-valuekeys 512 bytes, values 256 KB, 1,000 per list page
Table rows256 KB; find/count scan up to 10,000 rows
Files25 MB; paths up to 1,024 bytes
Schedulesat most every 5 minutes
Logged bodiesfirst 2,000 characters