Sean
Sean
WWasp
Created by Sean on 2/10/2025 in #đŸ™‹questions
APIs keep returning 404 error
I've been using chatgpt to write an OAuth integration with Notion. (my app needs access to Notion). However, I keep getting a 404 error whenever I try to do any api calls. I even have a foobar function & endpoint and it gets the same result. I've double checked all Notion API related configurations like client IDs, etc and made sure they are all correct. For the notion authorization, it is the callback that is failing. After authorizing Notion, it redirects to http://localhost:3000/api/auth/notion/callback?code=03ed839c-59bf-41a9-9d9b-e4a5697e9d03&state= but the UI shows a 404 error. In Postman, it shows the html from main.wasp and a "You need to enable JavaScript to run this app." message. I am using wasp 0.16.0 on macos (m1 pro macbook pro)
//#region Notion Integration
route ConnectNotionRoute { path: "/connect-notion", to: ConnectNotionPage }
page ConnectNotionPage {
authRequired: true,
component: import ConnectNotionPage from "@src/connect-notion/ConnectNotionPage"
}

api NotionOAuthCallback {
fn: import { notionOAuthCallback } from "@src/server/notion",
httpRoute: (GET, "/auth/notion/callback")
}
//#endregion
//#region Notion Integration
route ConnectNotionRoute { path: "/connect-notion", to: ConnectNotionPage }
page ConnectNotionPage {
authRequired: true,
component: import ConnectNotionPage from "@src/connect-notion/ConnectNotionPage"
}

api NotionOAuthCallback {
fn: import { notionOAuthCallback } from "@src/server/notion",
httpRoute: (GET, "/auth/notion/callback")
}
//#endregion
// src/server/notion.ts
import { Request, Response } from "express";

export async function notionOAuthCallback(req: Request, res: Response, context: any) {
// oauth code
}
// src/server/notion.ts
import { Request, Response } from "express";

export async function notionOAuthCallback(req: Request, res: Response, context: any) {
// oauth code
}
30 replies