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

202
Views
supabase download image bad request headers should have required property 'authorization'

im having trouble downloading an image from supabase. I get this errror

{
"statusCode": "400",
"error": "Bad Request",
"message": "headers should have required property 'authorization'"
}

I've followed the docs https://supabase.io/docs/guides/with-nextjs

here is my code for the request

const myQuote = ({ dataFetch }) => {
  const [avatarUrl, setAvatarUrl] = useState(null);

  async function downloadImage(path) {
    try {
      const { data, error } = await supabase.storage
        .from("job-photo")
        .download(`jobphotos/${path}.jpg`);
      if (error) {
        throw error;
      }
      const url = URL.createObjectURL(data);
      setAvatarUrl(url);
    } catch (error) {
      console.log("Error downloading image: ", error.message);
    }
  }

  return (
    <>
      <Dashboard />
      <QuoteTable tableData={dataFetch} downloadImg={downloadImage} />
    </>
  );
};

export default myQuote;
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Managed to get it working by adding public/ to from

 const { data, error } = await supabase.storage
        .from("public/job-photo")
        .download(`jobphotos/${path}.jpg`);
about 4 years ago · Juan Pablo Isaza Report

0

do you have the following code?

import { createClient } from '@supabase/supabase-js'

const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY

export const supabase = createClient(supabaseUrl, supabaseAnonKey)
about 4 years ago · Juan Pablo Isaza Report
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!