Francismiko
Francismiko
CCConvex Community
Created by Francismiko on 7/12/2023 in #support-community
The storage API returns a status code of 503
Thank you for your efforts, if there are any problems, I will continue to feedback🐎
9 replies
CCConvex Community
Created by Francismiko on 7/12/2023 in #support-community
The storage API returns a status code of 503
Is there an estimated repair time? Since my project has been deployed to the production environment, this will have a certain impact🏄‍♂️
9 replies
CCConvex Community
Created by Francismiko on 7/12/2023 in #support-community
The storage API returns a status code of 503
Works fine in most cases
9 replies
CCConvex Community
Created by Francismiko on 7/12/2023 in #support-community
The storage API returns a status code of 503
const postUrl = await getUrl() const result = await fetch(postUrl, { method: "POST", headers: { "Content-Type": file.type }, body: file, }) const res = await result.json() console.log({ res })
9 replies
CCConvex Community
Created by Francismiko on 7/12/2023 in #support-community
The storage API returns a status code of 503
res: code: "Overloaded" message: "InternalServerError: Your request couldn't be completed. Try again later."
9 replies
CCConvex Community
Created by Francismiko on 6/29/2023 in #support-community
How can I still deploy locally with Vercel?
Ah~ When I temporarily removed the relevant configuration files and variables from vercel in env locally, the problem was solved. I have to say that the development team has done very carefully in these details, reducing the possibility of mistakes caused by many mistakes in development 🥰
3 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
@ballingt yep, I'm using @clerk/clerk-react": ^4.15.3 . This is my root render code
const convex = new ConvexReactClient(
process.env.NEXT_PUBLIC_CONVEX_URL as string,
{ verbose: true },
)

<ClerkAuthProvider publishableKey={process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}>
<AppProvider...>
<ConvexProviderWithClerk client={convex}>
<AppLayout...>
const convex = new ConvexReactClient(
process.env.NEXT_PUBLIC_CONVEX_URL as string,
{ verbose: true },
)

<ClerkAuthProvider publishableKey={process.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY}>
<AppProvider...>
<ConvexProviderWithClerk client={convex}>
<AppLayout...>
14 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
No effect, I'm looking for where the error occurs👨‍💻
14 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
I am using the Yarn 3.0 version as a package management tool. It is very strange. I have never encountered this error before.😂
14 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
The same error happens on isLoading
14 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
There is such a console error:
app-layout.tsx:127 Uncaught TypeError: Cannot destruction property 'isAuthenticated' of '(0 , convex_react__WEBPACK_IMPORTED_MODULE_8__.useConvexAuth)(...)' as it is undefined.
at Authenticated (app-layout.tsx:127:11)
at renderWithHooks (react-dom. development. js:16305:1)
at mountIndeterminateComponent (react-dom. development. js:20074:1)
at beginWork (react-dom. development. js:21587:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom. development. js:4277:1)
at beginWork$1 (react-dom. development. js:27451:1)
at performUnitOfWork (react-dom. development. js:26557:1)
at workLoopSync (react-dom. development. js:26466:1)
at renderRootSync (react-dom. development. js:26434:1)
at performConcurrentWorkOnRoot (react-dom. development. js:25738:1)
at workLoop (scheduler. development. js:266:1)
at flushWork (scheduler. development. js:239:1)
at MessagePort.performWorkUntilDeadline (scheduler.development.js:533:1)
app-layout.tsx:127 Uncaught TypeError: Cannot destruction property 'isAuthenticated' of '(0 , convex_react__WEBPACK_IMPORTED_MODULE_8__.useConvexAuth)(...)' as it is undefined.
at Authenticated (app-layout.tsx:127:11)
at renderWithHooks (react-dom. development. js:16305:1)
at mountIndeterminateComponent (react-dom. development. js:20074:1)
at beginWork (react-dom. development. js:21587:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom. development. js:4277:1)
at beginWork$1 (react-dom. development. js:27451:1)
at performUnitOfWork (react-dom. development. js:26557:1)
at workLoopSync (react-dom. development. js:26466:1)
at renderRootSync (react-dom. development. js:26434:1)
at performConcurrentWorkOnRoot (react-dom. development. js:25738:1)
at workLoop (scheduler. development. js:266:1)
at flushWork (scheduler. development. js:239:1)
at MessagePort.performWorkUntilDeadline (scheduler.development.js:533:1)
14 replies
CCConvex Community
Created by Francismiko on 6/27/2023 in #support-community
`useConvexAuth()` returns undefined (resolved: two versions of convex package loaded)
I use code like this
const { isAuthenticated, isLoading } = useConvexAuth()
const { isAuthenticated, isLoading } = useConvexAuth()
in frontend react
14 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
Awesome! Now all the issues with webhooks are finally resolved perfectly. If in the future we can "use node" in HTTP, then can we migrate the core logic to it without the need to define it in the action (although that way is also concise)?In any case, I'm extremely grateful for @ari assistance!
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
By the way, I am using version 0.16 of convex
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
At first I thought that the reason for the error was that I did not pass the original object of the request as a parameter to the stripe webhook (http defaults to the Request type of the fetch api? I am not sure if this has any effect) but after debugging, I found that the same error still occurs , so the possibility of this error should be ruled out?
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
http.ts
const http = httpRouter()

http.route({
path: '/invoice',
method: 'POST',
handler: httpAction(async ({ runMutation, runAction }, request) => {
const stripe = await runAction('action:createStripe')
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET as string
const sig = request.headers.get('stripe-signature') as string

try {
const event = stripe.webhooks.constructEvent(
await request.text(),
sig,
webhookSecret,
)
if (event.type === 'invoice.payment_succeeded') {
const invId = (event.data.object as { id: string }).id
await runMutation('xxx:create', { invoice: invId })
}
return new Response(null, {
status: 200,
})
} catch (err) {
return new Response('Webhook Error', {
status: 400,
})
}
}),
})

export default http
const http = httpRouter()

http.route({
path: '/invoice',
method: 'POST',
handler: httpAction(async ({ runMutation, runAction }, request) => {
const stripe = await runAction('action:createStripe')
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET as string
const sig = request.headers.get('stripe-signature') as string

try {
const event = stripe.webhooks.constructEvent(
await request.text(),
sig,
webhookSecret,
)
if (event.type === 'invoice.payment_succeeded') {
const invId = (event.data.object as { id: string }).id
await runMutation('xxx:create', { invoice: invId })
}
return new Response(null, {
status: 200,
})
} catch (err) {
return new Response('Webhook Error', {
status: 400,
})
}
}),
})

export default http
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
action.ts
export const createStripe = internalAction({
handler: async () => {
return new Stripe(process.env.STRIPE_SECRET_KEY as string, {
apiVersion: '2022-11-15',
})
},
})
export const createStripe = internalAction({
handler: async () => {
return new Stripe(process.env.STRIPE_SECRET_KEY as string, {
apiVersion: '2022-11-15',
})
},
})
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
@ari Of course I can! Here is my code in the project:
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
{
"error_message": "Uncaught Error: Converting circular structure to JSON\n --> starting at object with constructor 'Stripe2'\n | property 'account' -> object with constructor 'Constructor'\n --- property '_stripe' closes the circle\n at stringifyValueForError (../node_modules/convex/src/values/value.ts:375:8)\n at convexToJsonInternal (../node_modules/convex/src/values/value.ts:484:10)\n at convexToJsonInternal (../node_modules/convex/src/values/value.ts:501:15)\n at convexToJson (../node_modules/convex/src/values/value.ts:549:0)\n at invokeAction (../node_modules/convex/src/server/impl/registration_impl.ts:250:0)\n"
}
{
"error_message": "Uncaught Error: Converting circular structure to JSON\n --> starting at object with constructor 'Stripe2'\n | property 'account' -> object with constructor 'Constructor'\n --- property '_stripe' closes the circle\n at stringifyValueForError (../node_modules/convex/src/values/value.ts:375:8)\n at convexToJsonInternal (../node_modules/convex/src/values/value.ts:484:10)\n at convexToJsonInternal (../node_modules/convex/src/values/value.ts:501:15)\n at convexToJson (../node_modules/convex/src/values/value.ts:549:0)\n at invokeAction (../node_modules/convex/src/server/impl/registration_impl.ts:250:0)\n"
}
54 replies
CCConvex Community
Created by Francismiko on 6/14/2023 in #support-community
What are the best practices for webhooks in actions?
When I refer here: https://discord.com/channels/1019350475847499849/1100122735872577596/1100122735872577596. After I migrated the steps of instantiating stripe to action, new error content appeared:
54 replies