Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bun with Astro on SSR issue with endpoints when running with > bunx --bun astro dev #14140

Open
copongcopong opened this issue Sep 24, 2024 · 0 comments
Labels
bug Something isn't working needs triage

Comments

@copongcopong
Copy link

What version of Bun is running?

1.1.30

What platform is your computer?

aarch64

What steps can reproduce the bug?

> bun create astro ... let it create the astro stack

> bunx astro add vercel ... add this for SSR adapter

create test endpoint in /src/pages/[...slug].ts

import type { APIRoute } from "astro"

export const GET: APIRoute = (ctx) => {
  const { slug } = ctx.params;
  return new Response(
    JSON.stringify({
      greeting: 'Hello',
      slug
    }),
  )
}

> bunx astro dev ... visit http://localhost:4321/slug/slug shows page with JSON
> bunx --bun astro dev ... visit http://localhost:4321/slug/slug triggers download (headers content-type: application/octet-stream)

What is the expected behavior?

> bunx astro dev and > bunx --bun astro dev both should show page

What do you see instead?

> bunx --bun astro dev shows headers as content-type: application/octet-stream triggering a page download

Additional information

{
  "name": "test-endpoint",
  "type": "module",
  "version": "0.0.1",
  "scripts": {
    "dev": "astro dev",
    "start": "astro dev",
    "build": "astro check && astro build",
    "preview": "astro preview",
    "astro": "astro"
  },
  "dependencies": {
    "@astrojs/check": "^0.9.3",
    "@astrojs/vercel": "^7.8.1",
    "astro": "^4.15.9",
    "typescript": "^5.6.2"
  }
}
@copongcopong copongcopong added bug Something isn't working needs triage labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant