I am unsure if my problem has arisen due to clearing the application cache or similar change whilst attempting to resolve:
However, reading:
https://forums.fauna.com/t/graphql-playground-broken-issues-processing-last-graphql-query-magically-resolved-but-unexplained-fauna-issue/530/3
gives me the impression this may be related(?).
I have a function I have been using in the Playground for past 2 weeks or so:
mutation CreateAndOrLoginUser {
createAndOrLoginUser(
active: true
user_name: "Test 1"
password: "hello"
ethaddress: "0x267be913fc79bbecb3c3ec88332a537d1c593a6d"
)
}
Previously each time I ran this function in PlayGround it would generate a token that I could then use for queries that required it (or create a new user).
Now when I click Play nothing happens.
Following is all the FQL I believe is relevant:
Index:
{
name: "unique_User_username",
unique: true,
serialized: true,
source: "User",
terms: [
{
field: ["data", "username"]
}
]
}
Function:
{
name: "create_andor_login_user",
role: Role("register"),
body: Query(
Lambda(
[
"active",
"username",
"password",
"ethaddress",
"description",
"email",
"mobile"
],
Let(
{
match: Match(Index("unique_User_username"), Var("username")),
user: If(
Exists(Var("match")),
Get(Var("match")),
Create(Collection("User"), {
credentials: { password: Var("password") },
data: {
active: Var("active"),
username: Var("username"),
ethaddress: Var("ethaddress"),
description: Var("description"),
email: Var("email"),
mobile: Var("mobile"),
member_since: ToMillis(Now())
}
})
),
login: Login(Select("ref", Var("user")), {
password: Var("password")
})
},
Select("secret", Var("login"))
)
)
)
}
Roles:
{
ref: Role("register"),
ts: 1599454745600000,
name: "register",
privileges: [
{
resource: Collection("User"),
actions: {
create: true,
read: true
}
},
{
resource: Index("unique_User_username"),
actions: {
unrestricted_read: false,
read: true
}
}
],
membership: []
}
{
ref: Role("bootstrap"),
ts: 1598942409805000,
name: "bootstrap",
privileges: [
{
resource: Ref(Ref("functions"), "create_andor_login_user"),
actions: {
call: true
}
}
],
membership: []
}
I used the ‘bootstrap’ secret key (correctly stored) in the httpheader when running the function. A query (query AllUserNames{allUserNames}) that uses a Basic authentication token, does work in the Playground (so there isn’t anything inherently wrong with the Playground).
Why has this function (mutation) stopped working in Playground?
Thanks