预览中的数据No data found for resource with given identifier
首先以为是nginx问题查看nginx日志
39.89.216.201 - - [27/Feb/2024:10:14:53 +0800] "POST /api/crm/clue/upload HTTP/1.1" 499 0 "https://op-dev.*.com/customer/clue-management" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.6045.160 Safari/537.36" "-"
nginx报499问题,开始修改nginx配置文件
server {
location / {
proxy_connect timeout 200;
proxy _send timeout 200;
proxy read timeout 200;
}}
没用,打开apifox请求接口发现请求正常,判断问题可能是前端问题,再次请求接口发现控制台打印错误信息
Uncaught (in promise) Error: timeout of 6000ms exceeded
解决办法:
前端项目用的是vue,在前端项目找到配置文件request.js,修改其timeout的时间即可
// create an axios instance
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
// timeout: 5000 // request timeout
timeout: 10000 // request timeout
})
还有一个办法在每个接口请求的地方设置timeout超时时间即可,注意是毫秒