gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.23k stars 10.32k forks source link

gatsby typescript production build error on Building static HTML for pages, which does finish build successfully! #12246

Closed JustFly1984 closed 5 years ago

JustFly1984 commented 5 years ago

I'm having this issue for 3 days already, tried everything


info bootstrap finished - 17.534 s

success Building production JavaScript and CSS bundles — 206.684 s
⠄ Building static HTML for pages(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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: 1)
(node:46869) [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.
(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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)
(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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: 3)
(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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: 4)
(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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: 5)
(node:46869) UnhandledPromiseRejectionWarning: Error: Cannot find module '[object Object]'
    at webpackContextResolve (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11)
    at webpackContext (/Users/justfly/projects/agrarian-gatsby/public/render-page.js:100880:11)
    at /Users/justfly/projects/agrarian-gatsby/public/render-page.js:101721:66
(node:46869) 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: 6)
success Building static HTML for pages — 22.215 s — 198/198 131.57 pages/second
Generated public/sw.js, which will precache 14 files, totaling 1118251 bytes.
onPostBuild exit code 0
✨  Done in 248.09s.

package.json:

  "dependencies": {
    "@aws-amplify/auth": "^1.2.15",
    "@babel/core": "7.3.4",
    "@babel/plugin-proposal-class-properties": "7.3.4",
    "@babel/plugin-proposal-object-rest-spread": "7.3.4",
    "@babel/plugin-syntax-dynamic-import": "7.2.0",
    "@babel/plugin-transform-runtime": "7.3.4",
    "@babel/plugin-transform-spread": "7.2.2",
    "@babel/polyfill": "7.2.5",
    "@babel/preset-env": "7.3.4",
    "@babel/preset-react": "7.0.0",
    "@babel/preset-typescript": "7.3.3",
    "@babel/types": "7.3.4",
    "@reach/router": "1.2.1",
    "@types/classnames": "2.2.7",
    "@types/core-js": "2.5.0",
    "@types/credit-card-type": "7.0.0",
    "@types/graphql": "14.0.7",
    "@types/intl": "1.2.0",
    "@types/jest": "24.0.9",
    "@types/node": "11.10.4",
    "@types/node-fetch": "^2.1.6",
    "@types/qrcode.react": "0.8.2",
    "@types/reach__router": "1.2.3",
    "@types/react": "16.8.6",
    "@types/react-dom": "16.8.2",
    "@types/react-helmet": "^5.0.8",
    "@types/react-hot-loader": "4.1.0",
    "@types/react-redux": "7.0.1",
    "@types/react-test-renderer": "16.8.1",
    "@types/react-toastify": "4.0.2",
    "@types/recompose": "0.30.5",
    "@types/redux-actions": "2.3.2",
    "@types/redux-debounced": "0.2.19",
    "@types/redux-immutable": "4.0.1",
    "@types/uniqid": "4.1.3",
    "@types/webpack": "4.4.25",
    "@types/webpack-env": "1.13.8",
    "@typescript-eslint/eslint-plugin": "1.4.2",
    "@typescript-eslint/parser": "1.4.2",
    "babel-eslint": "9.0.0",
    "babel-plugin-import-graphql": "2.6.2",
    "babel-plugin-macros": "2.5.0",
    "babel-plugin-transform-react-remove-prop-types": "0.4.24",
    "babel-plugin-transform-remove-console": "6.9.4",
    "classnames": "2.2.6",
    "core-js": "2.6.5",
    "credit-card-type": "8.1.0",
    "css-loader": "2.1.0",
    "cypress": "3.1.5",
    "dayjs": "1.8.8",
    "draft-js": "0.10.x",
    "eslint": "5.15.0",
    "eslint-config-prettier": "4.1.0",
    "eslint-config-standard": "12.0.0",
    "eslint-config-standard-react": "7.0.2",
    "eslint-config-typescript": "2.0.0",
    "eslint-import-resolver-typescript": "1.1.1",
    "eslint-loader": "2.1.2",
    "eslint-plugin-ascii": "1.0.0",
    "eslint-plugin-babel": "5.3.0",
    "eslint-plugin-css-modules": "2.11.0",
    "eslint-plugin-dependencies": "2.4.0",
    "eslint-plugin-graphql": "3.0.3",
    "eslint-plugin-html": "5.0.3",
    "eslint-plugin-import": "2.16.0",
    "eslint-plugin-jest": "22.3.0",
    "eslint-plugin-json": "1.4.0",
    "eslint-plugin-jsx-a11y": "6.2.1",
    "eslint-plugin-no-inferred-method-name": "1.0.2",
    "eslint-plugin-node": "8.0.1",
    "eslint-plugin-prettier": "3.0.1",
    "eslint-plugin-promise": "4.0.1",
    "eslint-plugin-promiseparams": "1.0.8",
    "eslint-plugin-react": "7.12.4",
    "eslint-plugin-react-functional-set-state": "1.2.1",
    "eslint-plugin-react-hooks": "1.4.0",
    "eslint-plugin-react-perf": "3.0.2",
    "eslint-plugin-react-redux": "3.0.1",
    "eslint-plugin-reselect": "6.6.0",
    "eslint-plugin-standard": "4.0.0",
    "eslint-plugin-xss": "0.1.9",
    "esquery": "1.0.1",
    "gatsby": "2.1.19",
    "gatsby-image": "2.0.30",
    "gatsby-plugin-eslint": "2.0.4",
    "gatsby-plugin-extract-schema": "0.0.5",
    "gatsby-plugin-manifest": "2.0.20",
    "gatsby-plugin-netlify": "2.0.11",
    "gatsby-plugin-no-sourcemaps": "2.0.2",
    "gatsby-plugin-offline": "2.0.24",
    "gatsby-plugin-purgecss": "3.1.0",
    "gatsby-plugin-react-helmet": "3.0.7",
    "gatsby-plugin-robots-txt": "1.4.0",
    "gatsby-plugin-sharp": "2.0.23",
    "gatsby-plugin-sitemap": "2.0.6",
    "gatsby-plugin-typescript": "2.0.9",
    "gatsby-plugin-typescript-checker": "1.0.3",
    "gatsby-plugin-webpack-bundle-analyzer": "1.0.4",
    "gatsby-source-filesystem": "2.0.23",
    "gatsby-transformer-sharp": "2.1.15",
    "graphql-tag": "2.10.1",
    "husky": "1.3.1",
    "immutable": "3.8.2",
    "intl": "1.2.5",
    "node-fetch": "2.3.0",
    "prettier": "1.16.4",
    "qrcode.react": "0.9.3",
    "react": "16.8.3",
    "react-dev-utils": "7.0.3",
    "react-dom": "16.8.3",
    "react-draft-wysiwyg": "1.13.1",
    "react-ga": "2.5.7",
    "react-gtm-module": "2.0.4",
    "react-helmet": "5.2.0",
    "react-redux": "6.0.1",
    "react-toastify": "4.5.2",
    "react-universal-component": "4.0.0",
    "react-wysiwyg-typescript": "1.0.2",
    "recompose": "0.30.0",
    "redux": "4.0.1",
    "redux-actions": "2.3.2",
    "redux-debounced": "0.5.0",
    "redux-immutable": "4.0.0",
    "redux-thunk": "2.3.0",
    "reselect": "4.0.0",
    "terser": "3.16.1",
    "ts-debounce": "1.0.0",
    "ts-node": "8.0.2",
    "tslib": "1.9.3",
    "tslint": "^5.13.1",
    "typescript": "3.3.3333",
    "uniqid": "5.0.3",
    "whatwg-fetch": "3.0.0"
  },
  "devDependencies": {
    "acorn": "6.1.1",
    "ajv": "6.9.2",
    "babel-jest": "24.1.0",
    "babel-plugin-universal-import": "4.0.0",
    "jest": "24.1.0",
    "jest-css-modules-transform": "2.1.1",
    "jest-transform-graphql": "2.1.0",
    "lint-staged": "8.1.5",
    "react-test-renderer": "16.8.3",
    "source-map-support": "0.5.10",
    "ts-jest": "24.0.0",
    "typed-css-modules": "0.3.7",
    "typescript-plugin-css-modules": "1.0.5",
    "webpack": "4.29.6"
  },

tsconfig.json

{
  "include": [
    "./src/**/**/*",
    "./**.{ts,tsx,js}",
    "./tests/**.*.tsx"
  ],
  "exclude": [
    "node_modules",
    "static",
    "public",
    "test",
    "./vscode",
    "./.cache",
    "__mocks__"
  ],
  "compilerOptions": {
    "typeRoots": [
      "./node_modules/@types",
      "./src/types"
    ],
    "types": [
      "classnames",
      "jest",
      "redux-debounced",
      "credit-card-type",
      "intl",
      "graphql",
      "node",
      "node-fetch",
      "qrcode.react",
      "reach__router",
      "react-dom",
      "react-helmet",
      "react-hot-loader",
      "react-toastify",
      "react-redux",
      "recompose",
      "redux-thunk",
      "redux-actions",
      "redux-debounced",
      "redux-immutable",
      "uniqid",
      "webpack",
      "webpack-env"
    ],
    "target": "es5",
    "module": "commonjs",
    "lib": [
      "dom",
      "es2017"
    ],
    "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
    "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
    "allowJs": false,
    "checkJs": false,
    "jsx": "react",
    "strict": true,
    "declaration": false,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noImplicitReturns": false,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "strictNullChecks": true,
    "noEmit": true,
    "skipLibCheck": false,
    "noEmitOnError": true,
    "removeComments": true,
    "moduleResolution": "node",
    "disableSizeLimit": true,
    "diagnostics": true,
    "alwaysStrict": true,
    "forceConsistentCasingInFileNames": true,
    "noErrorTruncation": true,
    "noFallthroughCasesInSwitch": true,
    "pretty": true,
    "noImplicitThis": true,
    "plugins": [
      {
        "name": "typescript-plugin-css-modules"
      }
    ],
    "baseUrl": "./",
    "paths": {
      "*": [
        "tests/*",
        "src/types/*",
        "src/graphql/*"
      ]
    }
  }
}

I need an advise how to debug.

DSchau commented 5 years ago

Hi @JustFly1984!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

DSchau commented 5 years ago

Also one note - I'd recommend updating gatsby. It contains a newer feature where it will log the path of the template/file/etc. that fails, which may help you further track this down.

gatsbot[bot] commented 5 years ago

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

Thanks for being a part of the Gatsby community! 💪💜

JustFly1984 commented 5 years ago

I'm always keeping my projects updated. This issue happening only in conjunction with gatsby-typescript plugin. I can't create minimal reproduction, cos I have no idea where does this bug coming from. The issue persist, not stale. I can't even figure out which package is to blame, cos /Users/justfly/projects/agrarian-gatsby/public/render-page.js:100886:11 is removed after build is finished.

gatsbot[bot] commented 5 years ago

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

JustFly1984 commented 5 years ago

please reopen, issue still persist.

wardpeet commented 5 years ago

Without a proper re-production, there is no point on keeping this open.

Thank you for understanding.