[{"data":1,"prerenderedAt":527,"buildId":528},["ShallowReactive",2],{"diagnostic-content-NITRO0033":3,"navigation_docs":426},{"id":4,"title":5,"body":6,"category":12,"code":414,"description":415,"docsUrl":13,"extension":416,"fix":417,"framework":418,"meta":419,"navigation":420,"pack":15,"path":421,"ruleId":16,"rulePath":17,"seo":422,"severity":18,"source":19,"sourceUrl":20,"stem":423,"why":424,"__hash__":425},"diagnostics\u002Fdiagnostics\u002FNITRO0033.md","NITRO0033: Pass background work to event.waitUntil",{"type":7,"value":8,"toc":404},"minimark",[9,21,26,38,42,48,52,57,60,215,218,334,338,341,372,376,388,392,400],[10,11],"rule-metadata",{"category":12,"docsUrl":13,"fix":14,"pack":15,"ruleId":16,"rulePath":17,"severity":18,"source":19,"sourceUrl":20},"handler","https:\u002F\u002Fnitro.build\u002Fdeploy\u002Fproviders\u002Fcloudflare","suggestion","vite-doctor\u002Fnitro","nitro\u002Fhandler\u002Frequire-waituntil-for-background-work","\u002Fnitro\u002Frules\u002Fhandler\u002Frequire-waituntil-for-background-work","warn","src\u002Frule-packs\u002Fnitro\u002Frules\u002Frequire-waituntil-for-background-work.ts","https:\u002F\u002Fgithub.com\u002Fwords-with-agents\u002Fvite-doctor\u002Fblob\u002Fmain\u002Fsrc\u002Frule-packs\u002Fnitro\u002Frules\u002Frequire-waituntil-for-background-work.ts",[22,23,25],"h2",{"id":24},"why-it-happens","Why it happens",[27,28,29,30,34,35,37],"p",{},"Cloudflare Workers and Vercel Functions can stop running once the response is sent, so a request or storage write the handler did not wait for can be cut off without an error. Nitro forwards event.",[31,32,33],"code",{},"waitUntil()"," to the platform's waitUntil on the Cloudflare presets (Nitro 2 and 3) and on Vercel (Nitro 3 only). Doctor reports only when the config names one of those presets statically and stays quiet for other or unknown presets. This is not a generic no-floating-promises check: a floating promise is fine in a long-lived Node.js server, and the fix here is event.",[31,36,33],{},", which only exists because of the platform. Doctor only counts calls it knows return a promise, and only statements in the handler body itself.",[22,39,41],{"id":40},"fix","Fix",[27,43,44,45,47],{},"Pass the promise to event.",[31,46,33],{}," so the platform keeps the request alive until it settles, or await it when the response depends on it.",[22,49,51],{"id":50},"example","Example",[53,54,56],"h3",{"id":55},"keep-the-webhook-alive-with-eventwaituntil","Keep the webhook alive with event.waitUntil()",[27,58,59],{},"Before",[61,62,67],"pre",{"className":63,"code":64,"language":65,"meta":66,"style":66},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","export default defineEventHandler(async (event) => {\n  const order = await readBody(event)\n  $fetch('https:\u002F\u002Fhooks.example.com\u002Forder', { method: 'POST', body: order })\n  return { ok: true }\n})\n","ts","",[31,68,69,110,136,187,207],{"__ignoreMap":66},[70,71,74,78,81,85,89,93,97,101,104,107],"span",{"class":72,"line":73},"line",1,[70,75,77],{"class":76},"s7zQu","export",[70,79,80],{"class":76}," default",[70,82,84],{"class":83},"s2Zo4"," defineEventHandler",[70,86,88],{"class":87},"sTEyZ","(",[70,90,92],{"class":91},"spNyl","async",[70,94,96],{"class":95},"sMK4o"," (",[70,98,100],{"class":99},"sHdIc","event",[70,102,103],{"class":95},")",[70,105,106],{"class":91}," =>",[70,108,109],{"class":95}," {\n",[70,111,113,116,119,122,125,128,131,133],{"class":72,"line":112},2,[70,114,115],{"class":91},"  const",[70,117,118],{"class":87}," order",[70,120,121],{"class":95}," =",[70,123,124],{"class":76}," await",[70,126,127],{"class":83}," readBody",[70,129,88],{"class":130},"swJcz",[70,132,100],{"class":87},[70,134,135],{"class":130},")\n",[70,137,139,142,144,147,151,153,156,159,162,165,168,171,173,175,178,180,182,185],{"class":72,"line":138},3,[70,140,141],{"class":83},"  $fetch",[70,143,88],{"class":130},[70,145,146],{"class":95},"'",[70,148,150],{"class":149},"sfazB","https:\u002F\u002Fhooks.example.com\u002Forder",[70,152,146],{"class":95},[70,154,155],{"class":95},",",[70,157,158],{"class":95}," {",[70,160,161],{"class":130}," method",[70,163,164],{"class":95},":",[70,166,167],{"class":95}," '",[70,169,170],{"class":149},"POST",[70,172,146],{"class":95},[70,174,155],{"class":95},[70,176,177],{"class":130}," body",[70,179,164],{"class":95},[70,181,118],{"class":87},[70,183,184],{"class":95}," }",[70,186,135],{"class":130},[70,188,190,193,195,198,200,204],{"class":72,"line":189},4,[70,191,192],{"class":76},"  return",[70,194,158],{"class":95},[70,196,197],{"class":130}," ok",[70,199,164],{"class":95},[70,201,203],{"class":202},"sfNiH"," true",[70,205,206],{"class":95}," }\n",[70,208,210,213],{"class":72,"line":209},5,[70,211,212],{"class":95},"}",[70,214,135],{"class":87},[27,216,217],{},"After",[61,219,221],{"className":63,"code":220,"language":65,"meta":66,"style":66},"export default defineEventHandler(async (event) => {\n  const order = await readBody(event)\n  event.waitUntil($fetch('https:\u002F\u002Fhooks.example.com\u002Forder', { method: 'POST', body: order }))\n  return { ok: true }\n})\n",[31,222,223,245,263,314,328],{"__ignoreMap":66},[70,224,225,227,229,231,233,235,237,239,241,243],{"class":72,"line":73},[70,226,77],{"class":76},[70,228,80],{"class":76},[70,230,84],{"class":83},[70,232,88],{"class":87},[70,234,92],{"class":91},[70,236,96],{"class":95},[70,238,100],{"class":99},[70,240,103],{"class":95},[70,242,106],{"class":91},[70,244,109],{"class":95},[70,246,247,249,251,253,255,257,259,261],{"class":72,"line":112},[70,248,115],{"class":91},[70,250,118],{"class":87},[70,252,121],{"class":95},[70,254,124],{"class":76},[70,256,127],{"class":83},[70,258,88],{"class":130},[70,260,100],{"class":87},[70,262,135],{"class":130},[70,264,265,268,271,274,276,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,311],{"class":72,"line":138},[70,266,267],{"class":87},"  event",[70,269,270],{"class":95},".",[70,272,273],{"class":83},"waitUntil",[70,275,88],{"class":130},[70,277,278],{"class":83},"$fetch",[70,280,88],{"class":130},[70,282,146],{"class":95},[70,284,150],{"class":149},[70,286,146],{"class":95},[70,288,155],{"class":95},[70,290,158],{"class":95},[70,292,161],{"class":130},[70,294,164],{"class":95},[70,296,167],{"class":95},[70,298,170],{"class":149},[70,300,146],{"class":95},[70,302,155],{"class":95},[70,304,177],{"class":130},[70,306,164],{"class":95},[70,308,118],{"class":87},[70,310,184],{"class":95},[70,312,313],{"class":130},"))\n",[70,315,316,318,320,322,324,326],{"class":72,"line":189},[70,317,192],{"class":76},[70,319,158],{"class":95},[70,321,197],{"class":130},[70,323,164],{"class":95},[70,325,203],{"class":202},[70,327,206],{"class":95},[70,329,330,332],{"class":72,"line":209},[70,331,212],{"class":95},[70,333,135],{"class":87},[22,335,337],{"id":336},"verify-the-fix","Verify the fix",[27,339,340],{},"Run only this rule after editing so the report stays focused on the diagnostic you are closing:",[61,342,346],{"className":343,"code":344,"language":345,"meta":66,"style":66},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","pnpm vite-doctor . --framework nitro --rules nitro\u002Fhandler\u002Frequire-waituntil-for-background-work\n","bash",[31,347,348],{"__ignoreMap":66},[70,349,350,354,357,360,363,366,369],{"class":72,"line":73},[70,351,353],{"class":352},"sBMFI","pnpm",[70,355,356],{"class":149}," vite-doctor",[70,358,359],{"class":149}," .",[70,361,362],{"class":149}," --framework",[70,364,365],{"class":149}," nitro",[70,367,368],{"class":149}," --rules",[70,370,371],{"class":149}," nitro\u002Fhandler\u002Frequire-waituntil-for-background-work\n",[22,373,375],{"id":374},"useful-links","Useful links",[377,378,379],"ul",{},[380,381,382],"li",{},[383,384,387],"a",{"href":13,"rel":385},[386],"nofollow","Upstream docs",[22,389,391],{"id":390},"related-rule","Related rule",[377,393,394],{},[380,395,396],{},[383,397,398],{"href":17},[31,399,16],{},[401,402,403],"style",{},"html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}",{"title":66,"searchDepth":112,"depth":112,"links":405},[406,407,408,411,412,413],{"id":24,"depth":112,"text":25},{"id":40,"depth":112,"text":41},{"id":50,"depth":112,"text":51,"children":409},[410],{"id":55,"depth":138,"text":56},{"id":336,"depth":112,"text":337},{"id":374,"depth":112,"text":375},{"id":390,"depth":112,"text":391},"NITRO0033","Report $fetch(), fetch(), event.fetch() and storage calls that a Nitro handler starts as a bare statement, without awaiting, returning or passing them to event.waitUntil(), on deployment presets where Nitro forwards waitUntil to the platform.","md","Pass the promise to event.waitUntil() so the platform keeps the request alive until it settles, or await it when the response depends on it.","nitro",{},true,"\u002Fdiagnostics\u002Fnitro0033",{"title":5,"description":415},"diagnostics\u002FNITRO0033","Cloudflare Workers and Vercel Functions can stop running once the response is sent, so a request or storage write the handler did not wait for can be cut off without an error. Nitro forwards event.waitUntil() to the platform's waitUntil on the Cloudflare presets (Nitro 2 and 3) and on Vercel (Nitro 3 only). Doctor reports only when the config names one of those presets statically and stays quiet for other or unknown presets. This is not a generic no-floating-promises check: a floating promise is fine in a long-lived Node.js server, and the fix here is event.waitUntil(), which only exists because of the platform. Doctor only counts calls it knows return a promise, and only statements in the handler body itself.","eG1m2mlTVvqsuoc8C9E9cJWpx_JFNE2nLSnB-Ws9MOM",[427,455,459,463,467,471,475,487,491,515,519,523],{"title":428,"path":429,"stem":430,"children":431,"icon":454},"CLI","\u002Fcli","1.cli\u002F1.index",[432,434,438,442,446,450],{"title":433,"path":429,"stem":430},"Run Doctor",{"title":435,"path":436,"stem":437},"Reports","\u002Fcli\u002Freports","1.cli\u002F2.reports",{"title":439,"path":440,"stem":441},"Configuration","\u002Fcli\u002Fconfiguration","1.cli\u002F3.configuration",{"title":443,"path":444,"stem":445},"CI and changed files","\u002Fcli\u002Fci","1.cli\u002F4.ci",{"title":447,"path":448,"stem":449},"Workspaces","\u002Fcli\u002Fworkspaces","1.cli\u002F5.workspaces",{"title":451,"path":452,"stem":453},"Cache and speed","\u002Fcli\u002Fcache","1.cli\u002F6.cache","i-lucide-terminal",{"title":456,"path":457,"stem":458},"Nuxt","\u002Fnuxt","2.nuxt",{"title":460,"path":461,"stem":462},"Vue","\u002Fvue","3.vue",{"title":464,"path":465,"stem":466},"Vite","\u002Fvite","4.vite",{"title":468,"path":469,"stem":470},"Nitro","\u002Fnitro","5.nitro",{"title":472,"path":473,"stem":474},"TypeScript","\u002Ftypescript","6.typescript",{"title":476,"path":477,"stem":478,"children":479,"icon":486},"Design system","\u002Fdesign-system","7.design-system\u002F1.index",[480,482],{"title":481,"path":477,"stem":478},"Overview",{"title":483,"path":484,"stem":485},"Classes and styles","\u002Fdesign-system\u002Fclasses","7.design-system\u002F2.classes","i-lucide-swatch-book",{"title":488,"path":489,"stem":490},"Package","\u002Fpackage","8.package",{"title":492,"path":493,"stem":494,"children":495,"icon":514},"Extending Doctor","\u002Fextending","9.extending\u002F1.index",[496,498,502,506,510],{"title":497,"path":493,"stem":494},"Write an extension",{"title":499,"path":500,"stem":501},"Visitors","\u002Fextending\u002Fvisitors","9.extending\u002F2.visitors",{"title":503,"path":504,"stem":505},"Ship with a library","\u002Fextending\u002Fshipping","9.extending\u002F3.shipping",{"title":507,"path":508,"stem":509},"Test a Rule","\u002Fextending\u002Ftesting","9.extending\u002F4.testing",{"title":511,"path":512,"stem":513},"Rule inputs","\u002Fextending\u002Frule-inputs","9.extending\u002F5.rule-inputs","i-lucide-puzzle",{"title":516,"path":517,"stem":518},"H3","\u002Fh3","9.h3",{"title":520,"path":521,"stem":522},"MCP","\u002Fmodel-context-protocol","9.model-context-protocol",{"title":524,"path":525,"stem":526},"Pinia","\u002Fpinia","9.pinia",1796507783975,"e745db9b-2064-477e-b678-8c0a05edc39c"]