inflearn logo
강의

Course

Instructor

[Code Camp] Highly concentrated backend course created at boot camp

http://localhost:3000/graphql 실행 후 query > getHello 시 오류

Resolved

2391

apk

32 asked

0

http://localhost:3000/graphql 실행 후 query > getHello 시 오류가 있습니다.

코드는 오타 없이 동일 한데, 저는 실행시

http://localhost:3000/graphql 여기서 아래와 같은 오류가 뜨는데 어떤 상황인지 파악이 잘 되지가 않습니다.

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field Query.getHello.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "getHello"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "stacktrace": [
            "Error: Cannot return null for non-nullable field Query.getHello.",
            "    at completeValue (/Users/back/study/20230119_nestjs/class/13-01-nestjs-with-graphql/node_modules/graphql/execution/execute.js:594:13)",
            "    at /Users/back/study/20230119_nestjs/class/13-01-nestjs-with-graphql/node_modules/graphql/execution/execute.js:486:9",
            "    at processTicksAndRejections (node:internal/process/task_queues:95:5)",
            "    at async Promise.all (index 0)",
            "    at execute (/Users/back/study/20230119_nestjs/class/13-01-nestjs-with-graphql/node_modules/apollo-server-core/src/requestPipeline.ts:501:14)",
            "    at processGraphQLRequest (/Users/back/study/20230119_nestjs/class/13-01-nestjs-with-graphql/node_modules/apollo-server-core/src/requestPipeline.ts:407:22)",
            "    at processHTTPRequest (/Users/back/study/20230119_nestjs/class/13-01-nestjs-with-graphql/node_modules/apollo-server-core/src/runHttpQuery.ts:436:24)"
          ]
        }
      }
    }
  ],
  "data": null
}

 

app.module.ts 에도 정상적으로 연결 해 두었습니다.

import { Module } from '@nestjs/common'
// import { AppController } from './app.controller';
// import { AppService } from './app.service';
import { BoardsModule } from './apis/boards/boards.module'
import { GraphQLModule } from '@nestjs/graphql'
import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo'

@Module({
  imports: [
    BoardsModule,
    GraphQLModule.forRoot<ApolloDriverConfig>({
      driver: ApolloDriver,
      autoSchemaFile: 'src/commons/graphql/schema.gql',
    }),
  ],
  // controllers: [AppController],
  // providers: [AppService],
})
export class AppModule {}

node.js NestJS javascript tdd rest-api docker nodejs nestjs express

Answer 1

0

apk

셀프자가해결

BoardsModule , BoardsService

저는 웹스톰이 자동으로 만들어주는 클래스 이름을 사용했었는데요. 그래서 위와 같이 s가 붙더라구요 이 부분을 모두 강의와 동일하게 아래와 같이 수정하였더니 정상 작동 되었습니다. 왜 이름변경으로 작동되었는지는 설명하지 못하겠습니다.

임포트나 익스포트 모두 문제는 없었고, 모듈에서도 정상적으로 프로바이드 되었었거든요.

해결은 되는데 이유는 모르니 깊이 있게 안다는것이 어려운 문제인거 같네요..

BoardModule , BoardService

그래프 ql 문서 사용할때 느낌표 남는거 어떻게 없애나요?

0

80

2

강의 전체 소스 코드를 받고싶습니다.

0

74

2

fontawesome 사용 문의

0

75

2

소스 코드 부탁드립니다~

0

84

2

깃 레포지터리 소스

0

78

2

커리큘럼12.css 정렬 에 나오는 과제 정답알고싶어요

0

71

2

10-01 Entity TypeOrmModule.forRoot 에 entities

0

83

3

강의 버전관련 문의입니다

0

101

2

Ubuntu 설치 관련

0

59

1

schema.gql 질문 드립니다.

0

49

1

서버 재실행시 Many to Many

0

100

3

input 관련 문의

0

89

2

Rest API 보다는 graphql이 주된 내용인데

0

130

2

강의 전체 소스코드 받을수있을까요?

0

153

1

도커볼륨 마운트 관련

0

125

2

findOne 타입스크립트오류

0

107

1

http => htrtps 호출 인증서 신뢰 오류

0

347

1

self-signed certificate in certificate chain 에러 발생

0

408

1

mongoose 설치 오류

0

140

1

특정 API, 특정 IP 허용 (단일경로에 CORS 활성화)

0

279

2

08-06

0

174

3

구조랑 패턴 관련해서 질문

0

121

2

mydocker

0

125

2

coolsms statuscode 2000 인데 전송안돼는 경우 확인.

0

153

1