Cant get console logs from api routes in NextJS #59259
Unanswered
amosmachora
asked this question in
App Router
Replies: 2 comments 2 replies
-
|
I meet the same problems. Did you found a solution for it @amosmachora ? |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
I noticed that Next.js creates a static page of those handlers sometimes and - for some obscure reason - drops the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying the old trick of
console.log("here")in my API routes but i can't seem to see thehereon my logs tab in Vercels dashboard. I found another discussion #21000 that was answered that he logs will show up in like 15 mins but something still doesn't seem right about the answer. Can someone expound on whats that and how i can make them show because im going nuts.`import { getAccessToken } from "@/util/utils";
import axios from "axios";
import { NextRequest, NextResponse } from "next/server";
const mpesaURL = process.env.MPESA_API_URL;
type RegisterURLParam = {
ShortCode: "601426" | string;
ResponseType: "Cancelled" | "Completed";
ConfirmationURL: string;
ValidationURL: string;
};
type RegisterURLResponse = {
OriginatorCoversationID: string;
ResponseCode: string;
ResponseDescription: string;
};
export const GET = async (req: NextRequest, res: NextResponse) => {
console.log("url registration requested");
const { access_token } = await getAccessToken();
const registerURLParam = {
ConfirmationURL: "https://out-of-the-street.vercel.app/api/confirmation",
ResponseType: "Completed",
ShortCode: "600999",
ValidationURL: "https://out-of-the-street.vercel.app/api/validation",
};
const response = await axios.post(
${mpesaURL}/mpesa/c2b/v1/registerurl,registerURLParam,
{
headers: {
"Content-Type": "application/json",
Authorization:
Bearer ${access_token},},
}
);
return NextResponse.json(response.data);
};
`
Beta Was this translation helpful? Give feedback.
All reactions