tauri-apps / tauri-apps/plugins-workspace
[bug] When Use fetch in js to send message to my python process,
- Dominant language
- Rust
- Stars
- 1.8k
- Forks
- 602
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
When I want to use tauri's fetch function to send data to my python program ( this program start in tauri::Command), I send it smoothly and get response in the first time, and when I send data to the same url the second time, the fetch function gets stuck in the "req.arrayBuffer()" step and keeps asking for memory. Until the webview crashes.
This only happens in release mode, not in dev mode

### Reproduction
_No response_
### Expected behavior
This only happens in release mode, not in dev mode。
I just call the function above:
```text
function sendMsgToPythonSocket(path: String, message: Map): Promise {
console.log(path, message)
return new Promise( (resolve, reject) => {
console.log("http promise init")
RustFetch("http://localhost:10025/py_tool_manager" + path, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(message),
}).then(
(response: Response) => {
response.clone().text()
.then(data => {
console.log(data)
resolve({
"data": data
});
})
}
)
// console.log(await response.text())
} )
}
```
default.json
```text
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
"description": "Capability for the main window",
"remote": {
"urls": ["https://", "http://" ],
"http":{
"urls": [
"http://localhost:10025/*",
"http://localhost:10025/tools_init"
]
},
"websocket": {
"urls": [
"ws://localhost:10025",
"ws://localhost:10025/*"
]
}
},
"windows": [
"main"
],
"permissions": [
"core:default",
"shell:allow-open",
"core:window:allow-start-dragging",
"core:window:allow-close",
"core:window:allow-maximize",
"core:window:allow-minimize",
"core:window:allow-start-resize-dragging",
"dialog:default",
{
"identifier": "shell:allow-execute",
"allow": [
{
"name": "exec-sh",
"cmd": "sh",
"args": [
"-c",
{
"validator": "\\S+"
}
],
"sidecar": false
},
{
"name": "exec-cmd",
"cmd": "cmd",
"args": [
"/c",
{
"validator": "\\S+"
}
],
"sidecar": false
}
]
},
"process:default",
"websocket:default",
"websocket:allow-connect",
"websocket:allow-send",
{
"identifier": "http:default",
"allow": [{ "url": "https://*.tauri.app" }, { "url": "http://localhost:10025/**" }]
},
"http:allow-fetch",
"http:allow-fetch-send",
"http:allow-fetch-read-body",
"http:allow-fetch-cancel"
]
}
```
### Full `tauri info` output
```text
[✔] Environment
- OS: Windows 10.0.19045 x86_64 (X64)
✔ WebView2: 130.0.2849.80
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
✔ cargo: 1.80.1 (376290515 2024-07-16)
✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (environment override by RUSTUP_TOOLCHAIN)
- node: 20.16.0
- pnpm: 9.12.1
- npm: 10.8.1
[-] Packages
- tauri 🦀: 2.0.4
- tauri-build 🦀: 2.0.1
- wry 🦀: 0.46.1
- tao 🦀: 0.30.3
- tauri-cli 🦀: 2.0.3
- @tauri-apps/api : 2.0.2 (outdated, latest: 2.1.1)
- @tauri-apps/cli : 2.0.3 (outdated, latest: 2.1.0)
[-] Plugins
- tauri-plugin-fs 🦀: 2.0.3
- @tauri-apps/plugin-fs : not installed!
- tauri-plugin-dialog 🦀: 2.0.3
- @tauri-apps/plugin-dialog : 2.0.1
- tauri-plugin-http 🦀: 2.0.3
- @tauri-apps/plugin-http : 2.0.1
- tauri-plugin-process 🦀: 2.0.1
- @tauri-apps/plugin-process : 2.0.0
- tauri-plugin-shell 🦀: 2.0.1
- @tauri-apps/plugin-shell : 2.0.0 (outdated, latest: 2.0.1)
- tauri-plugin-localhost 🦀: 2.0.1
- @tauri-apps/plugin-localhost : not installed!
- tauri-plugin-websocket 🦀: 2.0.1
- @tauri-apps/plugin-websocket : 2.0.0
[-] App
- build-type: bundle
- CSP: unset
- frontendDist: ../dist
- devUrl: http://localhost:1420/
- framework: Vue.js
- bundler: Vite
```
### Stack trace
_No response_
### Additional context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.