-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Open
Labels
ScRT: JSIssues/PRs related to the JavaScript scripting runtimeIssues/PRs related to the JavaScript scripting runtimebugtriageNeeds a preliminary assessment to determine the urgency and required actionNeeds a preliminary assessment to determine the urgency and required action
Description
What happened?
Sending an event containing a Proxy object causes a msgpack error.
I am not sure if the msgpack is supposed to handle this or not.
Sending a shallow copy instead of the Proxy seems to be a workaround.
[ script:luxu_admin] Error: error 1 TypeError: r.toArray is not a function
[ script:luxu_admin] at n (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:21782)
[ script:luxu_admin] at w (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:22128)
[ script:luxu_admin] at r (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:18198)
[ script:luxu_admin] at m (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:22425)
[ script:luxu_admin] at w (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:22095)
[ script:luxu_admin] at n.r [as encode] (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:18198)
[ script:luxu_admin] at n.write (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:7940)
[ script:luxu_admin] at Object.n [as encode] (@luxu_admin/citizen:/scripting/v8/msgpack.js:29:8057)
[ script:luxu_admin] at pack (@luxu_admin/citizen:/scripting/v8/main.js:50:31)
[ script:luxu_admin] at global.emitNet (@luxu_admin/citizen:/scripting/v8/main.js:282:27)
Expected result
Msgpack should be able to send the value of proxies
Reproduction steps
const payload = new Proxy(
{},
{
get(target, property) {
return property;
},
}
)
// Produces msgpack error
try {
emitNet('test',-1, payload)
} catch (error) {
console.error("error 1", error);
}
// Doesn't produce error by sending a shallow copy
try {
emitNet('test',-1, {...payload})
} catch (error) {
console.error("error 2", error);
}Importancy
There's a workaround
Area(s)
ScRT: JS
Specific version(s)
FiveM Artifacts 17000+
Additional information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ScRT: JSIssues/PRs related to the JavaScript scripting runtimeIssues/PRs related to the JavaScript scripting runtimebugtriageNeeds a preliminary assessment to determine the urgency and required actionNeeds a preliminary assessment to determine the urgency and required action