Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译出来的mac app 报网络错误 #179

Open
wlevene opened this issue Apr 25, 2024 · 24 comments
Open

编译出来的mac app 报网络错误 #179

wlevene opened this issue Apr 25, 2024 · 24 comments
Assignees

Comments

@wlevene
Copy link

wlevene commented Apr 25, 2024

服务地址改到自己搭建的服务器,通过docker安装的
网页版本是正常工作的
地址弹出看过了,是正确的

image
@zmh-program
Copy link
Member

Tauri 打包的应用 F12 应该是可以看到控制台的 提供一下日志

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

dev 模式报错如下:
image
image

release 报的是最开始的上面提到的内容,两个错误还不一样

release模式下的包 是不是打不开这个调试面板呀,试了 F12和其它方式,并没能打开控制台

@zmh-program
Copy link
Member

看url

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

image 是我服务端部署的有问题吗?服务端的日志没看到有请求上来

@zmh-program
Copy link
Member

zmh-program commented Apr 27, 2024

要加/api
https://example.com/api

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

debug可以了, 感谢。 release还是不行

cargo tauri dev 可以工作
cargo tauri build 还是同样的报错
image
image

@zmh-program
Copy link
Member

环境变量,配置有没有更改, dev 是否设置为 true

export function getRestApi(deploy: boolean): string {
/**
* return the REST API address
*/
return !deploy ? "http://localhost:8094" : backendEndpoint;
}
export function getWebsocketApi(deploy: boolean): string {
/**
* return the WebSocket API address
*/
if (!deploy) return "ws://localhost:8094";
if (backendEndpoint.startsWith("http://"))
return `ws://${backendEndpoint.slice(7)}`;
if (backendEndpoint.startsWith("https://"))
return `wss://${backendEndpoint.slice(8)}`;
if (backendEndpoint.startsWith("/"))
return location.protocol === "https:"
? `wss://${location.host}${backendEndpoint}`
: `ws://${location.host}${backendEndpoint}`;
return backendEndpoint;
}
export function getTokenField(deploy: boolean): string {
/**
* return the token field name in localStorage
*/
return deploy ? "token" : "token-dev";
}

@zmh-program
Copy link
Member

zmh-program commented Apr 27, 2024

还有,非商业版,需要把 --mode deeptrain 删掉, 或者修改 ~/app/.env.deeptrain 的 USE_DEEPTRAIN 那一行删掉。

https://github.com/Deeptrain-Community/chatnio/blob/main/app/src-tauri/tauri.conf.json#L4

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

image
image

还是一样报网络错

@zmh-program
Copy link
Member

提供你的参数配置和环境变量

@zmh-program
Copy link
Member

image
image

还是一样报网络错

没让你这么改...

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

image
image

@zmh-program
Copy link
Member

.env
加上/api

vite的.env的优先级大于config

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

image
加上了 /api

@zmh-program
Copy link
Member

server error是谁加的,前端提供具体的服务端返回的response发过来

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

image
前端提供具体的服务端返回的response在 release模式下不知道怎么看 。。。 release打不开控制台吧

image
没看到有请求发出去

@zmh-program
Copy link
Member

改一下toast的报错信息

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

要改成啥 : ( 前端 新手,尴尬

@zmh-program
Copy link
Member

浏览器能复现吗,如果是浏览器能复现到相同问题的话你可以看一下浏览器的返回。

一般如果是chatnio的bug的话,tauri和正常浏览器都是相同的报错

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

浏览器 没问题
cargo tauri dev 没问题
cargo tauri build 报错

@zmh-program
Copy link
Member

那怪了,一样的配置 应该是所有地方都有问题才对,我怀疑可能是 tauri 自身哪部分的配置有问题
但是我 Windows / Ubuntu 都无法复现此问题

@wlevene
Copy link
Author

wlevene commented Apr 27, 2024

感谢耐心回复,我再研究下,应该是我环境那里有问题

@zmh-program
Copy link
Member

我没有 Mac 设备,此问题转接 @XiaomaiTX

@XiaomaiTX
Copy link
Contributor

Mark,于工作日查看,休假ing
QWQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants