How to Display All User Avatars Using SupaBase Public URL?

Utilizing Next.js framework with SupaBase

I am attempting to retrieve all user avatars stored in a column within the "Profiles" table.

https://i.stack.imgur.com/wGgrO.png

Currently, I am only receiving the image name "placeholder.png". How can I extract the public URL and iterate over it for each user?

Below is my code snippet:

function Users({ profiles, url }) {
    return (
        <div className="flex -space-x-2 overflow-hidden">
          {console.log(profiles)}
          {profiles.map((profile, index) => (
            <div className="person" key={index}>
              <p>{profile.username}</p>
    
              <img
                className="inline-block h-10 w-10 rounded-full ring-2 ring-white"
                src={profile.avatar_url}
                alt=""
              />
            </div>
          ))}
        </div>
    );
}
    
export default Users;
    
export async function getServerSideProps() {
    const { data: profiles, error } = await supabase.from("profiles").select("*");
    
      {
        error ? console.log(error) : console.log(profiles);
      }
    
      return {
        props: {
          profiles,
        },
    };
}

Result:

https://i.stack.imgur.com/4DfWa.png

Answer №1

The container in SupaBase was not accessible to the public!

You can verify this by inspecting your Container as displayed below.

(To make it public, hover over the container and click on the 3 dots.)

https://i.stack.imgur.com/h9rL2.png

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Steps for creating and deploying a next.js project to Netlify without using automated tools

Netlify documentation states that next.js is supported through the Essential Build Plugin and manual deployments via CLI command. However, the question remains: how can a combination of these two methods be used to build a next.js project in a custom CI en ...

Troubleshooting: Next.js application deployment on Azure Web App encountering file discrepancies

I'm currently facing an issue while attempting to deploy a next.js (with typescript) application on Azure using Bitbucket pipelines. As part of my pipeline process, I build the next.js app with the following build configuration: // next.config.js /** ...

React.js Form Validation issue: When using input type "number", the text field remains a single value even after attempting to delete characters with the backspace key

Experiencing difficulty in clearing the input field value, even after pressing backspace the value remains constant. One particular value persists in the input field. import * as React from "react"; import { Button, Form } from "react-boots ...

Encountering difficulties with uploading upcoming project on a cpanel hosting due to an issue with the npm package

While attempting to upload my next project on a cpanel, I encountered an error during the installation of npm packages. npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency treenpm ERR! ERR! Found: <a href="/cdn-cgi/l/email-protection" c ...

What is the best way to incorporate variables into the useState hook in React?

I want to create multiple useState hooks based on the length of the userInputs array. The naming convention should be userInput0, userInput1, userInput2,...userInputN. However, using "const [userInput+index.toString(), setUserInput] = useState('' ...

encountering difficulties while trying to install packages using npm

I encountered some issues while setting up a react-app and attempted to resolve them by deleting /node-modules and reinstalling, but the problems persist. I'm using Ubuntu as my operating system. Can someone assist me with this? Below is the error log ...

Effectively controlling two distinct Azure resources within one domain name through domain routing

I am currently in the process of deploying a React application on Microsoft Azure that includes a basic content management feature. Essentially, when users visit the website and access static content, the app retrieves HTML code from a database and display ...

Upon refreshing the website, a 404 error suddenly appears on the GitHub Pages platform

Need help fixing a problem with a 404 error popping up on my gh-pages after updating the page. Strangely, when I refresh the main page, everything seems fine without any errors. However, if I navigate to another page and then update it, the 404 error appea ...

Encountering a React-timestamp problem with the error message "Unable to locate 'react' in the node modules directory."

My journey of creating an App using React was going smoothly until I decided to install react-timestamp via npm for converting unix time (https://www.npmjs.com/package/react-timestamp). However, now I'm encountering a compilation error that states: ...

Challenges with TypeScript build in DevOps related to Material UI Box Component

Currently, I am facing an issue while trying to build a front end React Typescript application using Material ui in my build pipeline on Azure DevOps. The problem seems to be related to the code for the Material ui library. Despite successfully building th ...

The React syntax is malfunctioning

componentDidMount() { const restaurants = Restaurant.all() restaurants.then( rests => { this.setState({ restaurants: rests }) }) } render() { const { restauran ...

Guide to integrating MPA frontend with SSR backend using Next.js?

I recently purchased an MUI template for my project. Utilizing React with Next.js and Flask as the backend, the MUI template functions as a Multiple-Page Application. In the past, I have utilized Flask for a Single Page Application by simply using return s ...

What are the reasons for not utilizing JSS to load Roboto font in material-ui library?

Why does Material-UI rely on the "typeface-roboto" CSS module to load the Roboto font, even though they typically use JSS for styling components? Does this mix of JSS and CSS contradict their usual approach? ...

Unpacking the information in React

My goal is to destructure coinsData so I can access the id globally and iterate through the data elsewhere. However, I am facing an issue with TypeScript on exporting CoinProvider: Type '({ children }: { children?: ReactNode; }) => void' is no ...

Trying to utilize RegEx for my project, but feeling stuck on how to solve my problem

^\d{1,12}$|(?=^.{1,15}$)^\d+\.\d{1,2}$ This is the current regular expression I am using. I need to adjust the maximum limit to 100,000,000,000 with an option for two decimal places. Additionally, I would like users to be able to inpu ...

The process.env.NEXT_PUBLIC variable in NextJS seems to be cleared out in production environments

I am facing an issue with my NextJS app "^11.1.2" when deploying it using Dockerfile and CI/CD to production. The problem arises with the rendering of my process.env variables Within my client-side code, I have the following line that should be rendered a ...

I'm having trouble with my react-big-calendar not updating when I switch between day, month, or week views -

Why won't my calendar change to the week view when I click on that section? https://i.stack.imgur.com/gh2aO.png In the screenshot above, my default view is set to month, but when I attempt to switch to week, it only highlights the option without cha ...

What could be causing the sanity cli to encounter an error during installation?

I'm facing an issue while attempting to execute the following commands: npm install -g @sanity/cli >> sanity init --coupon javascriptmastery2022 and this error message is displayed: sanity : File C:\Users\...\AppData\Roaming ...

Tips for keeping components mounted despite changes in the path

How can I maintain state in React routes to prevent unmounting when switching between them? In my application, it's crucial to keep the state intact during route changes. When changing routes, the respective components mount and unmount. How can this ...

Endless loop occurs with post and put requests while attempting to refresh authentication token

Every time the token expires in my application with NEXTjs and I attempt to make a post request, it gets stuck in a loop. The POST request returns 401, then the refresh-token returns 200 after attempting the post again, it returns 401, and the cycle repeat ...