{"id":5097,"date":"2026-01-23T09:06:56","date_gmt":"2026-01-23T17:06:56","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/"},"modified":"2026-01-23T09:06:56","modified_gmt":"2026-01-23T17:06:56","slug":"using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/","title":{"rendered":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><b>The problem: \u201cStateless\u201d doesn\u2019t mean \u201csetup-free\u201d<\/b><\/h2>\n\n\n\n<p><span>Couchbase Eventing is intentionally built like a short-running, stateless lambda: react to a mutation, do some work, exit. That model is clean \u2013 until your eventing function needs <\/span><i><span>one-time<\/span><\/i><span> housekeeping before it can safely process the first mutation.<\/span><\/p>\n\n\n\n<p><span>Historically, developers worked around this by doing a \u201cfirst mutation warmup\u201d inside OnUpdate, often with CAS-safe writes or counters so only one thread would load a shared state. That approach can work, but it forces you to depend on a mutation just to establish prerequisites, and it pushes setup concerns into the hottest part of your code path: mutation processing.<\/span><span><br>\n<\/span><span><br>\n<\/span><span>This is exactly why there was a need for a mutationless initialization concept in Eventing \u2013 an explicit setup phase that can run without an initial mutation and make the function ready before any real work begins.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>The idea: a pre-flight checklist<\/b><\/h2>\n\n\n\n<p><b>OnDeploy<\/b><span> is a new Eventing handler that runs <\/span><b>once<\/b><span> when an Eventing function is:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>deployed<\/b><span>, or<\/span><\/li>\n\n\n<li><b>resumed<\/b><span> (after being paused)<\/span><\/li>\n\n<\/ul>\n\n\n\n<p><span>And, importantly, <\/span><b>it runs before any mutations are processed<\/b><span>.<\/span><\/p>\n\n\n\n<p><span>If you think of your Eventing function like an aircraft:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>OnUpdate<\/span><span> \/ <\/span><span>OnDelete<\/span><span> are the flight operations.<\/span><\/li>\n\n\n<li><b>OnDeploy is the pre-flight check.<\/b><\/li>\n\n\n<li><span>If the pre-flight check fails, <\/span><b>the plane doesn\u2019t leave the runway<\/b><span>.<\/span><\/li>\n\n<\/ul>\n\n\n\n<p><span>That \u201cgatekeeper\u201d behavior is the key: <\/span><b>if<\/b> <b>OnDeploy<\/b><b> fails, the function reverts to the previous state<\/b><span> \u2013 protecting you from \u201cmisconfigured logic goes live\u201d scenarios.<\/span><\/p>\n\n\n\n<p><b>How it works: <\/b><b>OnDeploy(action)<\/b><\/p>\n\n\n\n<p><span>If you define an <\/span><span>OnDeploy<\/span><span> handler in your eventing function code, it will be invoked once with an <\/span><span>action<\/span><span> argument.<\/span><\/p>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]function OnDeploy(action) {<br \/>\n  \/\/ your setup code<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p><span>Where:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>action.reason<\/span><span> is one of:<\/span>\n<ul>\n<li><span>&#8220;deploy&#8221;<\/span><span>: a fresh eventing function deploy<\/span><\/li>\n<li><span>&#8220;resume&#8221;<\/span><span>: resuming after a pause<\/span><\/li>\n<\/ul>\n<\/li>\n\n\n<li><span>action.delay<\/span><span> is:<\/span>\n<ul>\n<li><span>0<\/span><span> on <\/span><span>&#8220;deploy&#8221;<\/span><\/li>\n<li><span>the effective paused duration (milliseconds) on <\/span><span>&#8220;resume&#8221;<\/span><\/li>\n<\/ul>\n<\/li>\n\n<\/ul>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-17842\" src=\"https:\/\/www.couchbase.com\/wp-content\/uploads\/sites\/5\/2026\/05\/Screenshot-2026-01-22-at-2.09.13-PM.png\" alt=\"\" width=\"1284\" height=\"782\"><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Two important safety rails<\/b><\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><b>Timeout:<\/b> <span>OnDeploy<\/span><span> must finish within the configured <\/span><b>OnDeploy Timeout <\/b><span>(default: 60 seconds). If it exceeds the timeout, the function deployment is not allowed to proceed.<\/span><\/li>\n\n\n<li><b>Fail-fast semantics:<\/b><span> If <\/span><span>OnDeploy<\/span><span> throws an error or fails, <\/span><b>no mutations are processed<\/b><span> and the function remains in its previous state.<\/span><\/li>\n\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Why this matters<\/b><\/h2>\n\n\n\n<p><span>OnDeploy isn\u2019t just \u201cnice to have.\u201d It\u2019s a shift in how you can design Eventing functions:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Correctness first:<\/b><span> Ensure prerequisites exist before any write logic runs.<\/span><\/li>\n\n\n<li><b>Less boilerplate:<\/b><span> Remove thread coordination hacks from <\/span><span>OnUpdate<\/span><span>.<\/span><\/li>\n\n\n<li><b>Faster time-to-first-correct-mutation:<\/b><span> Warm caches once, not per thread.<\/span><\/li>\n\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table>\n<tbody>\n<tr>\n<td><b>Aspect<\/b><\/td>\n<td><b>Without OnDeploy\u00a0<\/b><\/td>\n<td><b>With OnDeploy<\/b><\/td>\n<\/tr>\n<tr>\n<td><span>Initialization<\/span><\/td>\n<td><span>In OnUpdate (race-prone)<\/span><\/td>\n<td><span>Once, before mutations<\/span><\/td>\n<\/tr>\n<tr>\n<td><span>Thread coordination<\/span><\/td>\n<td><span>Required<\/span><\/td>\n<td><span>Not needed<\/span><\/td>\n<\/tr>\n<tr>\n<td><span>Setup guarantee<\/span><\/td>\n<td><span>Best effort<\/span><\/td>\n<td><span>Fail-fast guarantee<\/span><\/td>\n<\/tr>\n<tr>\n<td><span>Deployment safety<\/span><\/td>\n<td><span>Silent failures possible<\/span><\/td>\n<td><span>Blocked if setup fails<\/span><\/td>\n<\/tr>\n<\/tbody>\n<\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Use cases<\/b><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>You need a lookup table (prices, exchange rates, configs) before any mutation is allowed to act on incomplete data.<\/span><\/li>\n\n\n<li><span>You want a recurring job (once a day, once an hour) but you don\u2019t want to \u201cfake\u201d a mutation just to start a <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/eventing\/eventing-timers.html\"><span>timer<\/span><\/a><span>.<\/span><\/li>\n\n\n<li><span>You want the function to refuse to run if prerequisites are missing \u2013 because it\u2019s better to block deployment than to silently produce wrong writes.<\/span><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Example 1: Warm a lookup table once, then schedule a daily refresh<\/b><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Scenario<\/b><\/h3>\n\n\n\n<p><span>You enrich documents with end-of-day stock prices. Prices are fetched daily from an external REST API, stored in a KV document, and used by every mutation afterward.<\/span><span><br>\n<\/span><span>With OnDeploy, you can do the warmup <\/span><b>once<\/b><span>, guaranteed, before any mutation is processed.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Code<\/b><\/h3>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]\/\/ Timer Callback: refresh prices daily<br \/>\nfunction RefreshPricesCallback(context) {<br \/>\n    log(&#8220;Refreshing stock prices from API&#8221;);<br \/>\n    var response = curl(&#8220;GET&#8221;, stock_api_binding, {path: &#8216;\/api\/eod-prices&#8217;});<br \/>\n    cache_bucket[&#8220;lookup::eod_prices&#8221;] = response.body;<\/p>\n<p>    \/\/ Re-schedule for tomorrow<br \/>\n    var tomorrow = new Date();<br \/>\n    tomorrow.setSeconds(tomorrow.getSeconds() + 86400); \/\/ 24 hours<br \/>\n    createTimer(RefreshPricesCallback, tomorrow, &#8220;refresh_prices&#8221;, {});<br \/>\n}<\/p>\n<p>\/\/ OnDeploy: initialize price cache once<br \/>\nfunction OnDeploy(action) {<br \/>\n    log(&#8220;OnDeploy: reason=&#8221; + action.reason);<\/p>\n<p>    \/\/ Fetch initial prices from external API<br \/>\n    var response = curl(&#8220;GET&#8221;, stock_api_binding, {path: &#8216;\/api\/eod-prices&#8217;});<br \/>\n    cache_bucket[&#8220;lookup::eod_prices&#8221;] = response.body;<\/p>\n<p>    \/\/ Schedule daily refresh timer<br \/>\n    var tomorrow = new Date();<br \/>\n    tomorrow.setSeconds(tomorrow.getSeconds() + 86400);<br \/>\n    createTimer(RefreshPricesCallback, tomorrow, &#8220;refresh_prices&#8221;, {});<\/p>\n<p>    log(&#8220;Price cache initialized and refresh timer scheduled&#8221;);<br \/>\n}<\/p>\n<p>\/\/ OnUpdate: enrich documents with cached prices<br \/>\nfunction OnUpdate(doc, meta) {<br \/>\n    var prices = cache_bucket[&#8220;lookup::eod_prices&#8221;];<\/p>\n<p>    doc.stockPrice = prices[doc.symbol];<br \/>\n    doc.enrichedAt = new Date().toISOString();<\/p>\n<p>    dst_bucket[meta.id] = doc;<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p><span>The advantages with this logic:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>No \u201cfirst mutation does setup\u201d surprise.<\/span><\/li>\n\n\n<li><span>No cross-thread complexity inside <\/span><span>OnUpdate<\/span><span>.<\/span><\/li>\n\n\n<li><span>Every mutation starts with the prerequisites in place.<\/span><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Example 2: Treat deploy and resume differently with OnDeploy<\/b><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Scenario<\/b><\/h3>\n\n\n\n<p><span>Sometimes the job isn\u2019t to \u201cschedule work\u201d \u2013 it\u2019s to <\/span><b>make your function safe to start (or safe to restart)<\/b><span>.<\/span><\/p>\n\n\n\n<p><span>For example, your Eventing function might depend on:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>external data (can be fetched via cURL bindings at first deployment), and<\/span><\/li>\n\n\n<li><span>configuration stored in Couchbase (that should be reloaded after a pause)<\/span><\/li>\n\n<\/ul>\n\n\n\n<p><span>This is a great fit for OnDeploy because it lets you <b>branch behavior based on lifecycle<\/b> and ensure your function is ready <i>before<\/i> processing any mutations.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><b>Code<\/b><\/h3>\n\n\n<p>[crayon lang=&#8221;default&#8221; decode=&#8221;true&#8221;]function OnDeploy(action) {<br \/>\n  log(&#8216;OnDeploy triggered. Reason:&#8217;, action.reason);<br \/>\n  switch (action.reason) {<br \/>\n    case &#8216;deploy&#8217;:<br \/>\n      \/\/ First-time deployment: fetch initial data needed by the function.<br \/>\n      log(&#8216;Bootstrapping: Performing first-time setup&#8230;&#8217;);<br \/>\n      bootstrap_external_data();<br \/>\n      break;<br \/>\n    case &#8216;resume&#8217;:<br \/>\n      \/\/ Function was paused and resumed: refresh any cached settings.<br \/>\n      log(&#8216;Configuration changed. Reloading settings&#8230;&#8217;);<br \/>\n      reload_config_from_bucket();<br \/>\n      break;<br \/>\n  }<br \/>\n}<br \/>\n[\/crayon]<\/p>\n\n\n\n<p><span><br>\n<\/span><span>This pattern keeps lifecycle logic explicit and clean:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><b>Deploy<\/b><span> becomes the moment you do one-time bootstrap work.<\/span><\/li>\n\n\n<li><b>Resume<\/b><span> becomes the moment you reconcile\/refresh config after pausing (<\/span><span>action.delay<\/span><span> tells you how long you were paused).<\/span><\/li>\n\n\n<li><span>Your mutation handlers stay focused on business logic because they can assume that the prerequisites are already satisfied.<\/span><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Design guidance: what <\/b><b><i>not<\/i><\/b><b> to do in OnDeploy<\/b><\/h2>\n\n\n\n<p><span>OnDeploy is powerful, but it is deliberately constrained:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span>Keep it <\/span><b>short<\/b><span> and <\/span><b>deterministic<\/b><span>.<\/span><\/li>\n\n\n<li><span>Avoid long-running loops that could delay deployment.<\/span><\/li>\n\n\n<li><span>Treat it like infrastructure code: validate prerequisites, initialize shared state, schedule work, then exit.<\/span><\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Conclusion<\/b><\/h2>\n\n\n\n<p><span>OnDeploy brings a fundamental shift to Couchbase Eventing: the ability to guarantee prerequisites are met before a single mutation is processed. Instead of scattering initialization logic across mutation handlers or relying on race-prone warmup hacks, you now have a single, explicit pre-flight check that runs once and fails fast if anything goes wrong.<\/span><\/p>\n\n\n\n<p><span>The result? Cleaner code, safer deployments, and confidence that your Eventing functions start in a known-good state every time.<\/span><\/p>\n\n\n\n<p><span>Ready to try it? OnDeploy is available from Couchbase Server 8.0 and above. Check out the documentation below to get started, and consider which of your existing Eventing functions could benefit from this pattern.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><b>References<\/b><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.couchbase.com\/server\/current\/eventing\/eventing-language-constructs.html#ondeploy_handler\"><span>Couchbase Eventing OnDeploy handler documentation<\/span><\/a><\/li>\n\n\n<li><a href=\"https:\/\/docs.couchbase.com\/server\/current\/eventing\/eventing-timers.html\"><span>Timers in Couchbase Eventing<\/span><\/a><\/li>\n\n<\/ul>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p>\u00a0<\/p>\n\n\n\n<p>\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The problem: \u201cStateless\u201d doesn\u2019t mean \u201csetup-free\u201d Couchbase Eventing is intentionally built like a short-running, stateless lambda: react to a mutation, do some work, exit. That model is clean \u2013 until your eventing function needs one-time housekeeping before it can safely process the first mutation. Historically, developers worked around this by doing a \u201cfirst mutation warmup\u201d [&hellip;]<\/p>\n","protected":false},"author":85689,"featured_media":5094,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[348],"tags":[],"ppma_author":[1026],"class_list":["post-5097","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-eventing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.6 (Yoast SEO v27.6) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup\" \/>\n<meta property=\"og:description\" content=\"The problem: \u201cStateless\u201d doesn\u2019t mean \u201csetup-free\u201d Couchbase Eventing is intentionally built like a short-running, stateless lambda: react to a mutation, do some work, exit. That model is clean \u2013 until your eventing function needs one-time housekeeping before it can safely process the first mutation. Historically, developers worked around this by doing a \u201cfirst mutation warmup\u201d [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-23T17:06:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1256\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hiren Bavaskar, Software Engineer\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hiren Bavaskar, Software Engineer\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/\"},\"author\":{\"name\":\"Hiren Bavaskar, Software Engineer\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/525fabf075216ee904f309ef71f8adc3\"},\"headline\":\"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup\",\"datePublished\":\"2026-01-23T17:06:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/\"},\"wordCount\":1091,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png\",\"articleSection\":[\"Eventing\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/\",\"name\":\"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png\",\"datePublished\":\"2026-01-23T17:06:56+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/05\\\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png\",\"width\":2400,\"height\":1256},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2026\\\/06\\\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/525fabf075216ee904f309ef71f8adc3\",\"name\":\"Hiren Bavaskar, Software Engineer\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g10edee70e9cbebec942875c641ed0d4c\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g\",\"caption\":\"Hiren Bavaskar, Software Engineer\"},\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/hiren\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/","og_locale":"es_MX","og_type":"article","og_title":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup","og_description":"The problem: \u201cStateless\u201d doesn\u2019t mean \u201csetup-free\u201d Couchbase Eventing is intentionally built like a short-running, stateless lambda: react to a mutation, do some work, exit. That model is clean \u2013 until your eventing function needs one-time housekeeping before it can safely process the first mutation. Historically, developers worked around this by doing a \u201cfirst mutation warmup\u201d [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/","og_site_name":"The Couchbase Blog","article_published_time":"2026-01-23T17:06:56+00:00","og_image":[{"width":2400,"height":1256,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png","type":"image\/png"}],"author":"Hiren Bavaskar, Software Engineer","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Hiren Bavaskar, Software Engineer","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/"},"author":{"name":"Hiren Bavaskar, Software Engineer","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/525fabf075216ee904f309ef71f8adc3"},"headline":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup","datePublished":"2026-01-23T17:06:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/"},"wordCount":1091,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png","articleSection":["Eventing"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/","url":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/","name":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png","datePublished":"2026-01-23T17:06:56+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Using-OnDeploy-in-Couchbase-Eventing-to-Gate-Mutations-With-Pre-Flight-Setup.png","width":2400,"height":1256},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/using-ondeploy-in-couchbase-eventing-to-gate-mutations-with-pre-flight-setup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Using OnDeploy in Couchbase Eventing to Gate Mutations With Pre-Flight Setup"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/06\/logo.svg","width":"1024","height":"1024","caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/525fabf075216ee904f309ef71f8adc3","name":"Hiren Bavaskar, Software Engineer","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g10edee70e9cbebec942875c641ed0d4c","url":"https:\/\/secure.gravatar.com\/avatar\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a9e674236dd9c3a8d123a394caeceb735a030d04fb541350f3ddacb92cef2bd6?s=96&d=mm&r=g","caption":"Hiren Bavaskar, Software Engineer"},"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/hiren\/"}]}},"acf":[],"authors":[{"term_id":1026,"user_id":85689,"is_guest":0,"slug":"hiren","display_name":"Hiren Bavaskar, Software Engineer","avatar_url":{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Hiren-1.jpeg","url2x":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/5\/2026\/05\/Hiren-1.jpeg"},"0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/5097","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/85689"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=5097"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/5097\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/5094"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=5097"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=5097"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=5097"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=5097"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}