in playground GUI there is a button: COPY CURL
if you try it in the terminal you can get more details about the error.
I had same problem and I got this response from curl:
{
"errors": [
{
"message": "Class constructor DataSource cannot be invoked without 'new'",
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"TypeError: Class constructor DataSource cannot be invoked without 'new'",
" at new UserAPI (/var/www/html/blog-project/server/src/datasources/user.ts:12:5)",
" at Object.dataSources (/var/www/html/blog-project/server/src/index.ts:30:14)",
" at /var/www/html/blog-project/server/node_modules/apollo-server-core/src/requestPipeline.ts:618:34",
" at Generator.next (<anonymous>)",
" at /var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:8:71",
" at new Promise (<anonymous>)",
" at __awaiter (/var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:4:12)",
" at initializeDataSources (/var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:323:20)",
" at Object.<anonymous> (/var/www/html/blog-project/server/node_modules/apollo-server-core/src/requestPipeline.ts:117:9)",
" at Generator.next (<anonymous>)",
" at /var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:8:71",
" at new Promise (<anonymous>)",
" at __awaiter (/var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:4:12)",
" at Object.processGraphQLRequest (/var/www/html/blog-project/server/node_modules/apollo-server-core/dist/requestPipeline.js:41:12)",
" at /var/www/html/blog-project/server/node_modules/apollo-server-core/src/runHttpQuery.ts:310:32",
" at Generator.next (<anonymous>)"
]
}
}
}
]
}
after search about Class constructor DataSource cannot be invoked without 'new'
I found this solution
This problem should be solved in Node.js by setting TypeScript target option to es6. Modern Node.js versions support ES6 classes, there is no need to transpile them.
so the solution: in tsconfig.json
setting target to es6