yapi icon indicating copy to clipboard operation
yapi copied to clipboard

can not ready undefined of delay, I think something missing in 'server/util/sandbox.js'

Open jialong5566 opened this issue 3 years ago • 2 comments

版本号

~ 1.10.1

什么问题

~ 高级mock 脚本使用,mock结果 运行出错, 我想在 sandbox.js 里面加一句 ‘script += "; return this;";’ 放在 ‘const result = await safeVm.run(script, context);’ 这句话之前就好了

如何复现此问题

~ 随便写个高级mock语句,console 都可以,然后开启使用,获取mock 数据

什么浏览器

~ Chrome

什么系统(Linux, Windows, macOS)

MacOS

jialong5566 avatar Sep 25 '21 13:09 jialong5566

script += "; return this;"; 可以的 @jialong5566

ariesly15 avatar Oct 12 '21 08:10 ariesly15

没修好,报了新问题 (node:51012) UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON --> starting at object with constructor 'Object' --- property 'global' closes the circle at stringify (<anonymous>) at writeChannelMessage (internal/child_process/serialization.js:117:20) at process.target._send (internal/child_process.js:812:17) at process.target.send (internal/child_process.js:710:19) at sendResult (/Users/binjie/Projects/yapi/node_modules/safeify/lib/runner.js:17:13) at run (/Users/binjie/Projects/yapi/node_modules/safeify/lib/runner.js:87:5) at processTicksAndRejections (internal/process/task_queues.js:95:5) (Use node --trace-warnings ...to show where the warning was created) (node:51012) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:51012) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Salty-salt avatar Jun 30 '22 09:06 Salty-salt