Skip to content

Reloading in bundle crashes the app. #2021

@joaobsantos

Description

@joaobsantos

Describe the bug
After you bundle your app, if you have a button with window.location.reload() or right click and refresh, the app crashes or the window says that 127.0.0.1 cannot process the request.

It seem to me that hes trying to get an asset from my folder and addin myurl(/chat/joao) in the last part of the path
Ex:
thread '' panicked at 'Could not read asset D:\Apps\2-Development\app-dashboard\build/chat/joao/'

To Reproduce
Steps to reproduce the behavior:

  1. create a javascript button with window.location.reload()
  2. bundle your app
  3. run it and press the button or right click and refresh
  4. See error

Expected behavior
Return to home url

Platform and Versions (please complete the following information):

Operating System - Windows_NT(10.0.19042) - win32/x64

Node.js environment
Node.js - 14.15.1
tauri.js - 0.14.1

Rust environment
rustc - 1.53.0
cargo - 1.53.0
tauri-bundler - 0.9.4

Global packages
NPM - 6.14.8
yarn - 1.22.10

App directory structure
/.git
/.storybook
/build
/node_modules
/public
/src
/src-tauri

App
tauri.rs - 0.11.1
mode - embedded-server
build-type - bundle
CSP - default-src blob: data: filesystem: ws: http: https: 'unsafe-eval' 'unsafe-inline'
distDir - ../build
devPath - http://localhost:3000

Additional context
Im using React with react-router-dom

Stack Trace
thread '' panicked at 'Could not read asset D:\Apps\2-Development\app-dashboard\build/chat/joao/', C:\Users\Joao.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-0.11.1\src\server.rs:14:25

stack backtrace:
0: 0x87b0dd - core::fmt::write
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\core\src\fmt\mod.rs:1094
1: 0x859461 - std::io::Write::write_fmtstd::sys::windows::stdio::Stderr
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\io\mod.rs:1584
2: 0x862f37 - std::sys_common::backtrace::_print
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\sys_common\backtrace.rs:49
3: 0x862f37 - std::sys_common::backtrace::print
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\sys_common\backtrace.rs:36
4: 0x862f37 - std::panicking::default_hook::{{closure}}
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:208
5: 0x862aa2 - std::panicking::default_hook
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:225
6: 0x86353b - std::panicking::rust_panic_with_hook
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:591
7: 0x863125 - std::panicking::begin_panic_handler::{{closure}}
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:497
8: 0x86131a - std::sys_common::backtrace::__rust_end_short_backtrace<closure-0,!>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\sys_common\backtrace.rs:141
9: 0x863062 - std::panicking::begin_panic_handler
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:493
10: 0x8ac913 - std::panicking::begin_panic_fmt
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\panicking.rs:435
11: 0x30a5a4 - tauri::server::asset_response::{{closure}}
at C:\Users\Joao.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-0.11.1\src\server.rs:14
12: 0x36f791 - core::result::Result<alloc::borrow::Cow<slice>, std::io::error::Error>::unwrap_or_else<alloc::borrow::Cow<slice>,std::io::error::Error,closure-0>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\core\src\result.rs:821
13: 0x80b10f - core::ptr::mut_ptr::{{impl}}::len
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\core\src\ptr\mut_ptr.rs:1176
14: 0x809602 - core::intrinsics::copy_nonoverlapping
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\core\src\intrinsics.rs:1861
15: 0x806f2b - alloc::slice::hack::{{impl}}::to_vec<u8,alloc::alloc::Global>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\alloc\src\slice.rs:217
16: 0x2aa997 - tauri::app::runner::spawn_server::{{closure}}
at C:\Users\Joao.cargo\registry\src\github.com-1ecc6299db9ec823\tauri-0.11.1\src\app\runner.rs:179
17: 0x2de5ae - std::sys_common::backtrace::__rust_begin_short_backtrace<closure-0,tuple<>>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\std\src\sys_common\backtrace.rs:125
18: 0x35bb67 - std::thread::{{impl}}::spawn_unchecked::{{closure}}::{{closure}}<closure-0,tuple<>>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\std\src\thread\mod.rs:481
19: 0x302e6d - core::mem::manually_drop::ManuallyDrop<std::panic::AssertUnwindSafe>::take<std::panic::AssertUnwindSafe>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\core\src\mem\manually_drop.rs:112
20: 0x38058c - tauri::endpoints::event::listen_fn
21: 0x378df7 - std::panicking::try<tuple<>,std::panic::AssertUnwindSafe>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\std\src\panicking.rs:343
22: 0x2a5057 - std::panic::catch_unwind<std::panic::AssertUnwindSafe,tuple<>>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\std\src\panic.rs:431
23: 0x75e0accf - SetThreadStackGuarantee
24: 0x28562f - core::ops::function::FnOnce::call_once<closure-0,tuple<>>
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\core\src\ops\function.rs:227
25: 0x86b4a4 - alloc::boxed::{{impl}}::call_once
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\alloc\src\boxed.rs:1546
26: 0x86b4a4 - alloc::boxed::{{impl}}::call_once
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b\library\alloc\src\boxed.rs:1546
27: 0x86b4a4 - std::sys::windows::thread::{{impl}}::new::thread_start
at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library\std\src\sys\windows\thread.rs:56
28: 0x76dffa29 - BaseThreadInitThunk
29: 0x77e37a9e - RtlGetAppContainerNamedObjectPath
30: 0x77e37a6e - RtlGetAppContainerNamedObjectPath

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions