Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of null (reading 'url') #22

Open
YacineAyechi opened this issue Feb 15, 2022 · 10 comments
Open

TypeError: Cannot read properties of null (reading 'url') #22

YacineAyechi opened this issue Feb 15, 2022 · 10 comments

Comments

@YacineAyechi
Copy link

image

@Beefy-py
Copy link

You probably forgot to fetch the photo in the graphQL query

@fransachmadhw
Copy link

You probably forgot to fetch the photo in the graphQL query

Me too. I already fetched the photo correctly. But, still get the same error

@fransachmadhw
Copy link

Owhhh. I found the solution. You probably haven't published your author profile photo at graphCMS. The photo is still a draft. That's why the error occurs

@bintang-prayoga
Copy link

Owhhh. I found the solution. You probably haven't published your author profile photo at graphCMS. The photo is still a draft. That's why the error occurs

i already have my photo published but it still doesn't work...

@fransachmadhw
Copy link

Owhhh. I found the solution. You probably haven't published your author profile photo at graphCMS. The photo is still a draft. That's why the error occurs

i already have my photo published but it still doesn't work...

Check all of your assets again in GraphCMS

@aliarnoos
Copy link

I'm facing the same problem. If your found a fix could you post it? please
Thank you

@AkshayEddula
Copy link

Go to assets section and select the images and Publish Them

@AmAnpreet235
Copy link

I m getting the same issue .any one can help?

@aliarnoos
Copy link

the issue is from the cms. although you have published the article you have to make sure to publish the image too. The image is probably an a pending mood waiting to be published

@Beefy-py
Copy link

Beefy-py commented May 7, 2023

Instead of getting the photo url like a property, try to call the url method on it like so

   src={urlForSanityImage(post.mainImage).width(200).url()}

urlForSanityImage is a function I export from a file with the following contents:

export const urlForSanityImage = (source: any) => {
  return builder.image(source);
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants