夏の雪Official
10/26/2022, 6:58 PMMarcus
10/26/2022, 7:16 PMJohn Bradens
10/27/2022, 1:08 AM{
me {
id
name
}
}
;
and when I do const { data } = useQuery(ME_QUERY);
console.log(data);
I get undefined. Please let me know if you'd like me to share any more infoJohn Bradens
10/27/2022, 1:09 AMJohn Bradens
10/27/2022, 1:10 AMfunction me(parent, args, context) {
const id = getUserId(context);
return context.prisma.user({ id });
}
John Bradens
10/27/2022, 1:16 AMquery {
me {
id
name
}
}
, I get errors. How do I get it to show me the username that is logged in?John Bradens
10/27/2022, 2:58 AMJohn Bradens
10/27/2022, 2:59 AMfunction getUserId(context) {
const Authorization = context.request.get("Authorization");
console.log("hello");
console.log(context.request);
if (Authorization) {
const token = Authorization.replace("Bearer ", "");
const { userId } = jwt.verify(token, process.env.APP_SECRET);
return userId;
}
throw new AuthError();
}
class AuthError extends Error {
constructor() {
super("Not authorized");
}
}
// function getUserId(req, authToken) {
// if (req) {
// const authHeader = req.headers.authorization;
// if (authHeader) {
// const token = authHeader.replace("Bearer ", "");
// if (!token) {
// throw new Error("No token found");
// }
// const { userId } = getTokenPayload(token);
// return userId;
// }
// } else if (authToken) {
// const { userId } = getTokenPayload(authToken);
// return userId;
// }
// throw new Error("Not authenticated");
// }
Cường Vũ
10/27/2022, 3:29 AMdb push
without losing data ?Nik
10/27/2022, 4:13 AMNik
10/27/2022, 4:45 AMDivya Jain
10/27/2022, 7:17 AMoriginalError": {
"is_panic": false,
"message": "Transaction API error: Transaction already closed: Transaction is no longer valid. Last state: 'Expired'.",
"meta": {
"error": "Transaction already closed: Transaction is no longer valid. Last state: 'Expired'."
},
"error_code": "P2028",
"clientVersion": "3.15.2"
},
I have been facing this issue when there are multiple queries in a transaction.
I tried to increased the timeout for some its working but for some its not
I referred to this thread https://github.com/prisma/prisma/issues/13713.
Then I even updated the Prisma version to 4.1.1 that also not helping that also referred from another thread
If anyone has any insights on how to resolve it. Please do share.Mark
10/27/2022, 7:41 AMfindMany
with a Prisma.ModelName.
But I get the following error: Each member of the union type has signatures
const modelName = 'todoItem';
return client[modelName].findMany(undefined);
I have a playground here