Polar Checkout not working

Hello guys, I'm working on a Nuxt project with better-auth and polar plugin. I have made this :
export default defineEventHandler(async (event) => {
  const slug = getRouterParam(event, 'slug')!

  console.log(slug)

  try {
    const data = await auth.api.polarCheckout({
      query: {
        productId: 'aee96d58-7509-4fd6-a429-f74e5461c145'
      },
      params: { slug },
      headers: event.headers
    })

    console.log(data)

    return data
  } catch (error) {
    console.log('error', error)

    throw createError({
      statusCode: 500,
      statusText: 'Internal Server Error'
    })
  }
})


When I make a request to this handler with an authenticated user, the request fail with code 500 so it go in the catch scope and when I log my error I see nothing.
Capture_decran_2025-03-06_120535.png
Was this page helpful?