Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 1.67 KB

File metadata and controls

27 lines (17 loc) · 1.67 KB

Fluxbase Integration Issue & Resolution Report

The Problem

The core issue was a mismatch between your deployment and your documentation.

When RevaDates tried to send database queries to https://fluxbase.vercel.app/api, the server kept returning a 405 Method Not Allowed error and crashing.

The Root Cause

  1. Wrong API Endpoint: The Fluxbase-Integration-Guide.pdf stated that queries should be sent to /v1/projects/<ID>/query. However, your actual fluxbase.vercel.app backend was built with Next.js App Router, and the actual route you configured to handle SQL execution was located at /api/execute-sql.

  2. Wrong Payload Structure: The PDF documented that the body should contain { "sql": "query string" }. However, your custom backend was programmed to strictly expect { "projectId": "...", "query": "..." }.

Because RevaDates was following the PDF instructions, Vercel had no idea what to do with the unexpected routes, so it immediately rejected the connections with a 405 Method Not Allowed.

The Solution

  1. Error Handling: I added try/catch blocks around all of the Server Actions in RevaDates so it handles server outages gracefully instead of throwing unhandled promise rejections and crashing Node.

  2. Custom URL Detection: I updated src/lib/fluxbase/server.ts to automatically detect if you are using the Vercel app. If so, it dynamically overrides the PDF instructions, formats the body to match your { projectId, query } layout, and targets the undocumented /api/execute-sql route.

  3. Response Parsing: I updated the mapper to parse the nested data.result.rows JSON object layout that the custom API returns.