For AI agents: this page in Markdown: https://www.pubnub.com/docs/faq/logic.md. Documentation index: https://www.pubnub.com/llms-full.txt.

Logic FAQ

5 questions on this page

Short answers to common questions about Functions and moderation.

Why does my Function return an "execution calls exceeds limit" error?​

When one execution goes over a call limit, the Function returns the error [<module>] execution calls exceeds limit: <limit>, followed by . Line: <number> when the line is known. <module> is xhr, kvstore, pubnub, publish, or vault.

For the number of calls allowed per execution, see Functions limits. To raise a limit, contact PubNub Support and include your subscribe keys.

Why do my Functions pause or stop running?​

On the Free plan, a Function deployment pauses 7 days after it's deployed. PubNub sends reminder emails before the pause. To run the Function again, redeploy it.

To keep a Function running without pauses, upgrade to a paid plan. Functions run your serverless code on messages in transit. For what each plan includes, see PubNub pricing.

How do I stop a published message from being delivered?​

In a Before Publish Function, return request.abort() to block the message, or request.ok() to let it through.

export default (request) => {
// shouldBlock is a condition your code sets
if (shouldBlock) {
return request.abort();
}
return request.ok();
}

How do I keep a count in a Function?​

Use kvstore.incrCounter() from the Functions KV store. It keeps an accurate count when many clients send events at the same time, such as votes from many devices or analytics events.

See incrCounter, which describes the call and its parameters.

Can I moderate messages?​

Yes, on paid plans. PubNub offers two moderation tools:

  • Channel Monitor. A moderator watches up to five channels at the same time and acts on messages in real time.
  • Auto Moderation, in beta. It checks messages for spam, profanity, and word masking before they are published.

Auto Moderation withholds only the messages it blocks. Reported and masked messages are still delivered.

To enable Auto Moderation, contact PubNub Support or Sales.

Was this page useful?

Last updated on