Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

327
Views
How to resolve 431 error - return base 64 from nitro server to frontend

I'm currently working on a project to learn more about Nuxt 3.

I am transforming an image on the server side and want to return a base 64 string back to the client:

// server/api/image.js
import imageToBase64 from 'image-to-base64'
export default defineEventHandler(async (event) => {
  const param = useQuery(event)
  const url = 'https://images-assets.nasa.gov/image/' + param.query + '/' + param.query + '~thumb.jpg'
  return await imageToBase64(url)
    .then(response => {
        return response // base 64
      })
    .catch(error => console.log(error))
})
// test.vue
const base64 = await $fetch(`/api/image?query=${el.id}`)

But I got an 431 error and don't know the right approach to fix the problem.

GET http://localhost:3000/9j/4AAQSkZJRgABAQAAAQABAAD/wAALCAIAAoABAREA/8QAHwAAAQUBACQoL/ [...] [HTTP/1.1 431 Request Header Fields Too Large 0ms]

Do you have any ideas? I only read about to clearing my browser cache...

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!