autosave is not work by using navigator.sendbeacon #22111

Closed
opened 2026-02-21 20:15:49 -05:00 by yindo · 1 comment
Owner

Originally created by @799189288 on GitHub (Feb 5, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.12.1

Cloud or Self Hosted

Cloud

Steps to reproduce

  1. get a start node and set a file variable a default value.
  2. switch the browser tab to trigger navigator.sendbeacon.
Image

instead of using sendbeacon , we can use keepalive + fetch.

fetch(`${API_PREFIX}${postParams.url}`, {
        method: 'POST',
        keepalive: true,
        headers: {
          'Content-Type': 'application/json'
        },
        body: JSON.stringify(postParams.params)
      }).catch((error) => {
        console.error('error:', error)
      })

✔️ Expected Behavior

save successfully

Actual Behavior

the data has reached 64kb, the limit data size of sendbeacon. and the request will be pendding forever.

Originally created by @799189288 on GitHub (Feb 5, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.12.1 ### Cloud or Self Hosted Cloud ### Steps to reproduce 1. get a start node and set a file variable a default value. 2. switch the browser tab to trigger navigator.sendbeacon. <img width="1293" height="19" alt="Image" src="https://github.com/user-attachments/assets/ca80b9e1-faa1-4c39-8127-c678f1604202" /> instead of using sendbeacon , we can use keepalive + fetch. ``` fetch(`${API_PREFIX}${postParams.url}`, { method: 'POST', keepalive: true, headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(postParams.params) }).catch((error) => { console.error('error:', error) }) ``` ### ✔️ Expected Behavior save successfully ### ❌ Actual Behavior the data has reached 64kb, the limit data size of sendbeacon. and the request will be pendding forever.
yindo added the 🐞 bug label 2026-02-21 20:15:49 -05:00
yindo closed this issue 2026-02-21 20:15:49 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 5, 2026):

Hi @799189288! I'm Dosu and I’m helping the dify team.

This is a known limitation: navigator.sendBeacon has a 64KB payload size cap in browsers. If your autosave data exceeds this, the request hangs or stays pending, so your changes aren't saved when switching tabs or closing the page. This matches what you see in the network tab with a pending "draft" request and 0 kB size.

A common workaround is to use fetch with keepalive: true, which can handle larger payloads more reliably during page unload, but even this can have browser-specific limits and isn't guaranteed for very large data.

To avoid data loss, try to keep workflows smaller, wait for the periodic autosave to trigger before leaving the page, or manually click "Publish" before switching tabs. For maintainers, adding payload size checks, error handling, or user warnings before tab close can help prevent silent failures. There is also a recent fix referenced in PR #15597 that addresses this issue by optimizing the autosave mechanism and considering alternatives for large payloads. More details and workarounds are discussed here and here.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Feb 5, 2026): <!-- Greeting --> Hi @799189288! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> This is a known limitation: navigator.sendBeacon has a 64KB payload size cap in browsers. If your autosave data exceeds this, the request hangs or stays pending, so your changes aren't saved when switching tabs or closing the page. This matches what you see in the network tab with a pending "draft" request and 0 kB size. A common workaround is to use fetch with keepalive: true, which can handle larger payloads more reliably during page unload, but even this can have browser-specific limits and isn't guaranteed for very large data. To avoid data loss, try to keep workflows smaller, wait for the periodic autosave to trigger before leaving the page, or manually click "Publish" before switching tabs. For maintainers, adding payload size checks, error handling, or user warnings before tab close can help prevent silent failures. There is also a recent fix referenced in PR #15597 that addresses this issue by optimizing the autosave mechanism and considering alternatives for large payloads. More details and workarounds are discussed [here](https://github.com/langgenius/dify/issues/29411) and [here](https://github.com/langgenius/dify/issues/18675). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/17d1cac3-0a4f-448e-a931-207d4d6e58eb?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20limitation%3A%20navigator.sendBeacon%20has%20a%2064KB%20payload%20size%20cap%20in%20browsers.%20If%20your%20autosave%20data%20exceeds%20this%2C%20the%20request%20hangs%20or%20stays%20pending%2C%20so%20your%20changes%20aren%27t%20saved%20when%20switching%20tabs%20or%20closing%20the%20page.%20This%20matches%20what%20you%20see%20in%20the%20network%20tab%20with%20a%20pending%20%22draft%22%20request%20and%200%20kB%20size.%20%0A%0AA%20common%20workaround%20is%20to%20use%20fetch%20with%20keepalive%3A%20true%2C%20which%20can%20handle%20larger%20payloads%20more%20reliably%20during%20page%20unload%2C%20but%20even%20this%20can%20have%20browser-specific%20limits%20and%20isn%27t%20guaranteed%20for%20very%20large%20data.%20%0A%0ATo%20avoid%20data%20loss%2C%20try%20to%20keep%20workflows%20smaller%2C%20wait%20for%20the%20periodic%20autosave%20to%20trigger%20before%20leaving%20the%20page%2C%20or%20manually%20click%20%22Publish%22%20before%20switching%20tabs.%20For%20maintainers%2C%20adding%20payload%20size%20checks%2C%20error%20handling%2C%20or%20user%20warnings%20before%20tab%20close%20can%20help%20prevent%20silent%20failures.%20There%20is%20also%20a%20recent%20fix%20referenced%20in%20PR%20%2315597%20that%20addresses%20this%20issue%20by%20optimizing%20the%20autosave%20mechanism%20and%20considering%20alternatives%20for%20large%20payloads.%20More%20details%20and%20workarounds%20are%20discussed%20%5Bhere%5D%28https%3A//github.com/langgenius/dify/issues/29411%29%20and%20%5Bhere%5D%28https%3A//github.com/langgenius/dify/issues/18675%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/32030)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22111