This Convex deployment does not have HTTP actions enabled.
I am trying to use Hono with Convex in my Nextjs application, but the endpoints are giving
This Convex deployment does not have HTTP actions enabled.responses I do not know what the issue is. Can Someone please guide me to the solution or maybe a repo that has Nextjs, hono and Convex all together? Here is the Code import { Hono } from "hono"; import { logger } from "hono/logger"; import stripAnsi from "strip-ansi"; import { HonoWithConvex, HttpRouterWithHono } from "./lib/honoWithConvex"; import { cors } from "hono/cors"; import { internal } from "./_generated/api"; const app: HonoWithConvex = new Hono(); // Custom 404 app.notFound((c) => { return c.text("Oh no! Couldn't find a route for that", 404); }); // Middleware! app.use( "", logger((...args) => { console.log(...args.map(stripAnsi)); }) ); // Set up CORS as middleware app.use("/api/", cors()); // This endpoint should be accessible from the browser. const apiRouter = app.basePath("/api"); // Nested as `/api/listMessages apiRouter.get("/listMessages", async (c) => { // Running a Convex query const messages = await c.env.runQuery(internal.messages.listAll); // Helpers for pretty JSON! return c.json(messages); }); apiRouter.get("/listMessages/:userId{[0-9]+}", async (c) => { // Extracting a token from the URL! const userId = c.req.param("userId"); // Running a Convex query const messages = await c.env.runQuery(internal.messages.listByAuthor, { authorNumber: userId, }); // Helpers for pretty JSON! return c.json(messages); }); const router = new HttpRouterWithHono(app); export default router;
4 Replies
GitHub
GitHub - imaxisXD/AIvy-Post
Contribute to imaxisXD/AIvy-Post development by creating an account on GitHub.
I don't know if we have examples of Convex+Nextjs+Hono, but i do know that to fix this particular error you should rename https.ts to http.ts
Thank you so so so much @lee , love you ❤️
For anyone else that may come looking for hono integraiton this project is using @sshader 's helper library here: https://stack.convex.dev/hono-with-convex
Advanced HTTP Endpoints: Convex ❤️ Hono
Adding advanced HTTP Endpoint functionality by extending Convex with Hono.