Skip to content

autosave is not work by using navigator.sendbeacon #32030

Closed

Description

@799189288

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.

Activity

  1. added
    🐞 bug
    on Feb 6, 2026
  2. dosubot commented on Feb 6, 2026

    @dosubot

    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.


    Docs are dead. Just use Dosu.

    Leave Feedback Ask Dosu about dify

  3. added a commit that references this issue on Feb 7, 2026
    4e1dfdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions