Hey,
I’ve created an function (shown below), when I call it (in the Shell) like so, it works perfectly fine, no errors at all.
Function Code:
Lambda(
["id", "prop"],
If(
Exists(Match(Index("guilds.id"), Var("id"))),
Select(Var("prop"), Get(Match(Index("guilds.id"), Var("id")))),
Select(
Var("prop"),
Create(Collection("guilds"), {
data: { guild: Var("id"), prefix: "$", disabled: [], commands: [] }
})
)
)
)
)
But when I call it in an TypeScript file (as shown below) it gives the following error (raw response)
responseRaw: '{"errors":[{"position":["from","from"],"code":"call error","description":"Calling the function resulted in an error.","cause":[{"position":["from","from","lambda"],"code":"invalid argument","description":"Lambda expects an array with 2 elements. Array contains 1."}]}]}',
The code I use to call the function:
Call(Function('guild'), ['748063801856753766', 'ref'])
(For reference, I call the function in the exact same way I do in Node as in the Shell.)
Nevermind I got the solution.
Hi @comic-dev
may I ask you to write a solution, if someone else happens to have the same problem for a future reference, or if there is a defect we can address it?
I was just misusing the function call in another file, the function code was all good.