{"action":"created","issue":{"url":"https://api.github.com/repos/nestjs/nest/issues/1332","repository_url":"https://api.github.com/repos/nestjs/nest","labels_url":"https://api.github.com/repos/nestjs/nest/issues/1332/labels{/name}","comments_url":"https://api.github.com/repos/nestjs/nest/issues/1332/comments","events_url":"https://api.github.com/repos/nestjs/nest/issues/1332/events","html_url":"https://github.com/nestjs/nest/issues/1332","id":386609697,"node_id":"MDU6SXNzdWUzODY2MDk2OTc=","number":1332,"title":"Example not working: 12-graphql-apollo","user":{"login":"Decimator","id":12205550,"node_id":"MDQ6VXNlcjEyMjA1NTUw","avatar_url":"https://avatars3.githubusercontent.com/u/12205550?v=4","gravatar_id":"","url":"https://api.github.com/users/Decimator","html_url":"https://github.com/Decimator","followers_url":"https://api.github.com/users/Decimator/followers","following_url":"https://api.github.com/users/Decimator/following{/other_user}","gists_url":"https://api.github.com/users/Decimator/gists{/gist_id}","starred_url":"https://api.github.com/users/Decimator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Decimator/subscriptions","organizations_url":"https://api.github.com/users/Decimator/orgs","repos_url":"https://api.github.com/users/Decimator/repos","events_url":"https://api.github.com/users/Decimator/events{/privacy}","received_events_url":"https://api.github.com/users/Decimator/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-12-02T22:50:46Z","updated_at":"2018-12-03T18:48:07Z","closed_at":"2018-12-03T18:48:07Z","author_association":"NONE","body":"## I'm submitting a...\r\n\r\n<pre><code>\r\n[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->\r\n[x] Bug report\r\n[ ] Feature request\r\n[x] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.\r\n</code></pre>\r\n\r\n\r\n## Current behavior\r\nThe vanilla \"12-graphql-apollo\" example can't be built. When attempting to build and then run the built files, this error appears:\r\n\"Query.getCats defined in resolvers, but not in schema\"\r\n\r\n\r\n## Expected behavior\r\nThe vanilla example should build correctly using tsc.\r\n\r\n\r\n## Minimal reproduction of the problem with instructions\r\n\r\n1. Go to 'nest -> sample -> 12-graphql-apollo' directory (the example project)\r\n2. $ npm install\r\n3. $ npm run prestart:prod\r\n4. $ cd dist\r\n5. $ node main.js\r\n6. Server starts, then crashes with the following error log:\r\n\r\n`(node:26488) UnhandledPromiseRejectionWarning: Error: Query.getCats defined in resolvers, but not in schema`\r\n`(node:26488) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)`\r\n`(node:26488) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.`\r\n\r\n## What is the motivation / use case for changing the behavior?\r\nTo help NestJS newcomers to understand and be able to use NestJS.\r\n\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nNest version: 5.4.1\r\n \r\nFor Tooling issues:\r\n- Node version: 8.11.4\r\n- Platform:  Windows\r\n\r\nOthers:\r\n<!-- Anything else relevant?  Operating system version, IDE, package manager, ... -->\r\n</code></pre>\r\n"},"comment":{"url":"https://api.github.com/repos/nestjs/nest/issues/comments/443823324","html_url":"https://github.com/nestjs/nest/issues/1332#issuecomment-443823324","issue_url":"https://api.github.com/repos/nestjs/nest/issues/1332","id":443823324,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MzgyMzMyNA==","user":{"login":"Decimator","id":12205550,"node_id":"MDQ6VXNlcjEyMjA1NTUw","avatar_url":"https://avatars3.githubusercontent.com/u/12205550?v=4","gravatar_id":"","url":"https://api.github.com/users/Decimator","html_url":"https://github.com/Decimator","followers_url":"https://api.github.com/users/Decimator/followers","following_url":"https://api.github.com/users/Decimator/following{/other_user}","gists_url":"https://api.github.com/users/Decimator/gists{/gist_id}","starred_url":"https://api.github.com/users/Decimator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Decimator/subscriptions","organizations_url":"https://api.github.com/users/Decimator/orgs","repos_url":"https://api.github.com/users/Decimator/repos","events_url":"https://api.github.com/users/Decimator/events{/privacy}","received_events_url":"https://api.github.com/users/Decimator/received_events","type":"User","site_admin":false},"created_at":"2018-12-03T18:48:07Z","updated_at":"2018-12-03T18:48:07Z","author_association":"NONE","body":"Thank you for the help @brianmcd! That's really helpful, and does indeed work.\r\n\r\nSo to conclude, it looks like I was asking two separate questions (both which @brianmcd generously answered):\r\n\r\n**Question:** When the [Minimal reproduction of the problem] commands are run, there seems to be an error that prevents the example from working.\r\n**Answer:** The example does work, when run with the correct command $npm run start:prod.\r\n\r\n**Question:** When building the project into /dist, node doesn't seem to be able to find the GraphQL schemas. Specifically it generates the error \"Error: Query.getCats defined in resolvers, but not in schema\"\r\n**Answer:** The .graphql files in the /src directory are not (currently) being copied over to /dist when the application is built.\r\n**Solution:** I tested Brian's proposed solution by manually copying the \"cats.graphql\" file from /src/cats, into the /dist folder (right alongside main.js) after building ($npm prestart:prod). Then when I ran the command $node main.js from within the /dist folder, and it works! This is potentially important for certain deployment options (in my case, deploying to an AWS Elastic Beanstalk instance. I have the project setup to deploy only the contents of the /dist directory)"}}
{"actor":{"display_login":"Decimator"}}