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

作为依赖安装,打包electron后返回为空 #1331

Open
5 tasks done
kiko-love opened this issue Dec 25, 2023 · 2 comments
Open
5 tasks done

作为依赖安装,打包electron后返回为空 #1331

kiko-love opened this issue Dec 25, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@kiko-love
Copy link

Bug 描述

在electron应用中作为依赖引入,调用match接口,开发环境可以正常使用,但是打包后运行exe返回为空,这是函数(修改了入口函数的入参构造,其余均未做修改)
static async matchMore(_event: any, query: any) { try { log.info('match_song_query:', query); const q = PlayerUtil.hanldeQuery(query) const { id,data, openFlac = true, musicLevel, followOrder } = q const res = await match(id, JSON.parse(JSON.stringify(data)), ['pyncmd', 'kuwo', 'qq'], openFlac, musicLevel, followOrder); log.info('match_res:', res); return res; } catch (error) { console.error(error); } }

预期行为

在electron打包后的生产环境正确返回匹配内容

实际行为

生产环境返回空值undefined

复现步骤

No response

启动命令及环境变量

依赖库使用,match()

日志内容

return undefined

网易云音乐歌曲链接

No response

网易云音乐版本号

lastest

操作系统

win11

其他信息

No response

问题排查

  • 我确认我使用的核心是由 UnblockNeteaseMusic 项目官方发行,不是其他任何 fork。
  • 我确认我已经升级到了最新的核心版本(推荐使用最新构建而不是 release)。
  • 我确认我已经启用了 HTTPS 端口。
  • 我确认我已经正确设置了 EndPoint。
  • 我确认我已经在对应的客户端正确安装了 CA 证书。
@kiko-love kiko-love added the bug Something isn't working label Dec 25, 2023
@kiko-love
Copy link
Author

命令行运行exe依赖库函数同样生效,但是当直接双击exe运行时,依赖函数却无法使用

@kiko-love
Copy link
Author

kiko-love commented Dec 25, 2023

问题已经解决了,问题隐藏地太深,经过不断地调试,原因是pino的日志输出流在打包后的生产环境下会顶替掉函数返回的内容导致返回undefined
由于我不太清楚pino底层的运作方式,所以不清楚为何会出现这样的情况
问题代码位于serve/ src/provider/match.js
function match()
...
const { id: audioId, name } = audioInfo; const { url } = audioData; logger.debug({ audioInfo, audioData }, 'The data to replace:'); logger.info( { audioId, songName: name, url, }, Replaced: [${audioId}] ${name} ); return audioData;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant