-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: ip function error "[object Object]" #50
Conversation
由于云函数 "ip" 中 hasCatch 是 await cache.get(ip); 属于一个对象,而下面直接对这个对象用了 JSON.parse,然后会报错 "message": "Function 执行报错: \"[object Object]\" is not valid JSON" 所以需要加一个判断,确保他是一个字符串 Signed-off-by: BLxcwg666 <huixcwg@gmail.com>
hi @BLxcwg666. 我想知道这是在哪里出现的这个报错😂 |
要是云函数里面配置了没修复的那个,你点开后台的评论管理里面,鼠标悬浮到ip上面,能查出来,你刷新一下,悬浮到同一个ip上面,就报错了,如果没复现需要我录视频复现一下吗 @wibus-wee |
或者你直接 curl https://后端域名/api/v2/fn/built-in/ip?ip=114.51.45.14 |
我这里无法复现这个问题😂 你能否提供一下出现报错问题时 hasCatch 的值?谢谢🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
我看了一下 Core 的代码,好像...已经parse了啊😂 |
不用了,我看到问题了哈哈哈 谢谢 |
Signed-off-by: BLxcwg666 <huixcwg@gmail.com>
已经改了,如果没问题可以合一下 pr 吗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢🙏
Description
由于云函数 "ip" 中
hasCatch
是await cache.get(ip);
属于一个对象,而下面直接对这个对象用了
JSON.parse
,然后会报错"message": "Function 执行报错: \"[object Object]\" is not valid JSON"
所以需要加一个判断,确保他是一个字符串,如果不是就转一下
Linked Issues
None
Additional context
None