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

223
Views
Possible Unhandled Promise Rejection (id: 25) with Sanity.io and React Native

I'm getting a warning when using the sanity CMS to retrieve data from the back end.

Here is my Code:

client.js

import sanityClient from "@sanity/client";
import imageUrlBuilder from "@sanity/image-url";

const client = sanityClient({
    projectId: "productKeyHidden",
    dataset: "production",
    apiVersion: "2022-03-10",
    useCdn: true,
    token:process.env.TOKEN,
});

const builder = imageUrlBuilder(client);

export const urlFor = (source) => {
    return builder.image(source);
}

Home.js

import { View, Image } from 'react-native';
import React, { useEffect, useState } from 'react';
import client from '../client';
import { urlFor } from '../client';
import styles from '../styles';
  
  export default function Home(){
    
    const [uploads, setUploads] = useState([]);

    const getImage = async () => {
      const query = `*[_type == 'upload']`
      const uploads = await client.fetch(query);

      setUploads(uploads);
    }

    useEffect(() => {
      getImage();
    }, [])
    
    return (
      <View>
        {uploads.map(
           upload => <Image source={urlFor(upload.image)} />}
      </View>
  )
}

It isn't retrieving the data but sometimes gives me the error destroy is not a function

How to fix it?

EDIT: forgot to put the urlFor() function while posting this. but anyways the error still remains

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!