• 카테고리

    질문 & 답변
  • 세부 분야

    프론트엔드

  • 해결 여부

    해결됨

쿼리오류 Field "thumbnail" must not have a selection...

23.02.12 23:10 작성 조회수 496

1

메인 페이지에서 Props로 받아 포스트 데이터 출력하기 강의에서

여기까지 한 후, 2개의 포스트 아이템이 화면에 잘 출력되는지 확인해주세요.
>>>> 이 부분까지 하고 실행을 하려니 아래와 같은 쿼리 오류가 생겼습니다.

There was an error in your GraphQL query:

      Field "thumbnail" must not have a selection since type "String" has no subfields.

      This can happen if you e.g. accidentally added { } to the field "thumbnail". If you didn't expect "thumbnail" to be of type "String" make sure that your input source and/or plugin is correct.
      However, if you expect "thumbnail" to exist, the field might be accessible in another subfield. Please try your query in GraphiQL.

      It is recommended to explicitly type your GraphQL schema if you want to use optional fields.

publicURL 을 못가져오는것 같은데.. 어떻게 해결해야할까요 ㅠ.ㅠ

레포지토리 남깁니다!

https://github.com/syankkim/syankkim.github.io

답변 1

답변을 작성해보세요.

0

안녕하세요, 김수연님!

레포지토리 확인해보니까 pages/index.tsx 파일에 쿼리문이 안보이네요 ㅠㅠ

혹시 푸쉬 여부 다시 확인 가능할까요?

김수연님의 프로필

김수연

질문자

2023.02.18

앗 안되어있었네요..!
gatsby-plugin-image 라이브러리로 최적화된 썸네일 사진 띄워주기 강의까지 코드 적용하여 푸쉬 해 두었습니다!
계속 같은 오류가 발생합니다 ㅠ.ㅠ 한번 확인 부탁드립니다 🙏🏻

image

안녕하세요, 김수연님!

확인해보니까 contents 디렉토리에 이미지 파일이 아무것도 없었네요.

profile-image.png 이미지 파일을 추가한 뒤 실행해보니 정상적으로 동작했습니다!

이미지 추가 후 다시 실행해보시겠어요?

김수연님의 프로필

김수연

질문자

2023.02.22

gatsby-plugin-image 라이브러리 강의 적용 이전 (GraphQL Query를 통해 이미지 링크를 받아와 이를 통해 썸네일 이미지를 띄워주도록 구현) 에는 contents 디렉토리 하위에 있었어도 아래와 같은 오류가 발생해서

Field "thumbnail" must not have a selection since type "String" has no subfields.

오류 발생해도 gatsby-plugin-image 라이브러리 적용하는 강의를 따라하면서 static 디렉토리로 옮겨봤었을 때 발생한 또다른 오류였습니다.
다시 contents 하위에도 넣어주니 동작하네요!! 감사합니다.

아래 쿼리에서 file은 static/ 하위 이미지들을 조회할 수 있는 필드를 의미하는걸까요 ?

    file(name: { eq: "profile-image" }) {
      childImageSharp {
        gatsbyImageData(width: 120, height: 120)
      }
    }

 

넵넵 맞습니다!