#zeke_error
1 messages ¡ Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- zeke_code, 1 hour ago, 24 messages
- zeke_checkout-morequestions, 21 hours ago, 106 messages
- zeke_error, 1 day ago, 10 messages
- zeke_checkout-question, 1 day ago, 38 messages
- zeke_connect-accountlink, 2 days ago, 9 messages
- zeke_unexpected, 2 days ago, 13 messages
and 7 more
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.
đ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1261439703735996448
đ Have more to share? Add details, code, screenshots, videos, etc. below.
import { stripe } from "@/lib/stripe";
export default async function handler(
req: { method: string; body: { account: any }; headers: { origin: any } },
res: {
json: (arg0: { url: any }) => void;
status: (arg0: number) => void;
send: (arg0: { error: any }) => void;
}
) {
if (req.method === "POST") {
try {
const { account } = req.body;
const accountLink = await stripe.accountLinks.create({
account: account,
refresh_url: `${req.headers.origin}/refresh/${account}`,
return_url: `${req.headers.origin}/return/${account}`,
type: "account_onboarding",
});
res.json({
url: accountLink.url,
});
} catch (error) {
console.error(
"An error occurred when calling the Stripe API to create an account link:",
error
);
res.status(500);
//@ts-expect-error
res.send({ error: error.message });
}
}
}
Hi two-shoes happy Friday!
Likewise! I'm digging in now. Will circle back in a sec
What's the actual error message you're getting?
its not exactly an error its a network status of an Endpoint
if you would like a ss I can provide
Im going to go work on more stuff for my business just @ me and Ill hear the jingle!
I don't know if we can really help much with that. If you don't have any browser console errors, network errors, or anything tangible to point to, we're kind of flying blind. It also sounds like this might not even be on the Stripe side of things, so we might not even be good folks to ask to begin with.
Ok I was just wondering because it was from your docs!
do you think it is a front end or backend error?
if you had to guess
Error Message
account_link status (pending) type fetch
What console does this error show up in?
Where does that other network request go? Click on it
The account one?
I just need to see the headers for the pending network request
Request URL:
http://localhost:3000/api/account_link
Referrer Policy:
strict-origin-when-cross-origin
Content-Type:
application/json
Referer:
http://localhost:3000/realm
there are no response headers
Okay, yeah. So the fetch() is waiting for the back-end to send something back.
I notice that you're not sending back an HTTP 200 anywhere in your back-end code, so that's probably what's going wrong
which would be this code right here:
import { stripe } from "@/lib/stripe";
export default async function handler(
req: { method: string; body: { account: any }; headers: { origin: any } },
res: {
json: (arg0: { url: any }) => void;
status: (arg0: number) => void;
send: (arg0: { error: any }) => void;
}
) {
if (req.method === "POST") {
try {
const { account } = req.body;
console.log("Received account ID:", account); // Logging the received account ID
const accountLink = await stripe.accountLinks.create({
account: account,
refresh_url: `${req.headers.origin}/refresh/${account}`,
return_url: `${req.headers.origin}/return/${account}`,
type: "account_onboarding",
});
console.log("Account link created:", accountLink); // Logging the created account link
res.json({
url: accountLink.url,
});
} catch (error) {
console.error(
"An error occurred when calling the Stripe API to create an account link:",
error
);
res.status(500);
//@ts-expect-error
res.send({ error: error.message });
}
}
}
Yup
ok so I just need to send a HTTP 200 in this code
Yup, you can just put res.send(); in your if statement such that it fires when no error is present
ok let me try that ill be right back
We close at 3:30, so let me know if anything happens before then and I'll try to answer your questions before I go
Hmm its still pending
import { stripe } from "@/lib/stripe";
export default async function handler(
req: { method: string; body: { account: any }; headers: { origin: any } },
res: {
json: (arg0: { url: any }) => void;
status: (arg0: number) => void;
send: (arg0?: { error?: any }) => void;
}
) {
if (req.method === "POST") {
try {
const { account } = req.body;
console.log("Received account ID:", account); // Logging the received account ID
const accountLink = await stripe.accountLinks.create({
account: account,
refresh_url: `${req.headers.origin}/refresh/${account}`,
return_url: `${req.headers.origin}/return/${account}`,
type: "account_onboarding",
});
console.log("Account link created:", accountLink); // Logging the created account link
res.json({
url: accountLink.url,
});
// Send response indicating success
res.send();
} catch (error) {
console.error(
"An error occurred when calling the Stripe API to create an account link:",
error
);
res.status(500);
//@ts-expect-error
res.send({ error: error.message });
}
}
}
did I do that correctly?
Try replacing this:
`res.json({
url: accountLink.url,
});
// Send response indicating success
res.send();`
With this:
res.send({ url: accountLink.url });
Ok ill go qucik!
Sorry for the edits. It was a copy/paste from my own code that I sent at first
I get this error Object literal may only specify known properties, and 'url' does not exist in type '{ error?: any; }'.ts(2353)
(property) url: any
its fine Ill figure it out I know you have to leave!!!!
I dont want you to work overtime!!
Have a good weekend!
will i still be able to see this thread?
I think that's just a Typescript compiler error. Unfortunately I gotta go, but hopefully you're able to Google that and figure out how to fix it.
If worst comes to worst, just use a Typescript ignore on that line with @ts-ignore
Yup! I'll close it, but you can still view it
Have a good weekend!
ok Sweet!!!