Amal ChandranA
Convex Community3mo ago
3 replies
Amal Chandran

Not able to connect to convex backend

I'm encountering an issue where I'm unable to connect to my Convex backend from a Node.js script, although the same endpoint URL works perfectly when accessed directly from my web browser.
import { api } from "@backend/convex/_generated/api";
import { ConvexHttpClient } from "convex/browser";
 
 
async function main() {
 
  const jwtToken = ""
 
  // Configure ConvexHttpClient with JWT authentication
  const client = new ConvexHttpClient("https://********.convex.cloud", {
    auth: jwtToken,
  });

  // Example: Use the client to make queries
  const result = await client.query(api.emails.getEmails, {});

  console.log(result);
}

main();
image.png
image.png
Was this page helpful?