Skip to content

Node.js compatibility: Bun.serve() in oauth.ts breaks browser OAuth on Node.js #30

@raylanlin

Description

@raylanlin

Problem

src/auth/oauth.ts uses Bun.serve() in waitForCallback(), which is Bun-specific and not available in Node.js 18+.

// src/auth/oauth.ts ~line 90
const server = Bun.serve({ port, fetch(req) { ... } });

This causes minimax auth login (browser OAuth flow) to throw ReferenceError: Bun is not defined when run under Node.js.

Impact

  • minimax auth login broken on Node.js
  • minimax auth login --no-browser (device code flow) unaffected
  • minimax auth login --api-key sk-xxxxx unaffected

Suggested Fix

Replace with Node.js built-in http.createServer().

Notes

Found while working on PR #29. Not including in that PR since auth module likely has dedicated ownership.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions