Pradhumansinh Padhiyar
PPrisma
•Created by Pradhumansinh Padhiyar on 9/10/2024 in #help-and-questions
Why always encounter this error after few mins
Yes i did, but after sometime same error will come again
8 replies
PPrisma
•Created by Pradhumansinh Padhiyar on 9/10/2024 in #help-and-questions
Why always encounter this error after few mins
@RaphaelEtim
8 replies
PPrisma
•Created by Pradhumansinh Padhiyar on 9/10/2024 in #help-and-questions
Why always encounter this error after few mins
Yes i have pgbouncer in DB URL. Im using Supabase for DB..
Connection String:- postgresql://postgres.awdzhicwvjfxpysuddsanj:[YOUR-PASSWORD]@aws-0-ap-south-1.pooler.supabase.com:6543/postgres?pgbouncer=true
Code:-
const userID = await prisma.users.findUnique({
where:{username:username},
select:{
id:true
}
});
if (!userID) {
return {status:404, data:
} const userHashnodeLink = await prisma.user_hashnode_links.findFirst({ where:{userid: userID?.id}, select:{url:true} }); if (!userHashnodeLink) { return {status:404, data:
User with username ${username} not found
}
} const userHashnodeLink = await prisma.user_hashnode_links.findFirst({ where:{userid: userID?.id}, select:{url:true} }); if (!userHashnodeLink) { return {status:404, data:
Hashnode link not found for user ${username}
}
}
const userHashnodeTheme = await prisma.user_themes.findFirst({
where:{userid: userID?.id},
select:{themeid:true}
});
if (!userHashnodeTheme) {
return {status:404, data:Hashnode Custom Theme not found for user ${username}
}
}
await fetch(${hashnodeAPIURL}
, {
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
query: FreeTheme,
variables: { host: userHashnodeLink?.url }
})
}).then(res => res.json()).then(json => blogContentFromHashnode = json)
console.log("Length ==> ",blogContentFromHashnode.data.publication.posts.edges.length);
return {status:200, themeID:userHashnodeTheme.themeid, blogData:blogContentFromHashnode.data, totalCount:blogContentFromHashnode.data.publication.posts.edges.length };8 replies