adamsoffer / next-apollo

React higher-order component for integrating Apollo Client with Next.js
MIT License
482 stars 64 forks source link

Error while running `getDataFromTree` TypeError: Object(...) is not a function #88

Closed joncursi closed 3 years ago

joncursi commented 3 years ago

I have next-apollo working great for NODE_ENV = 'development'. However, my production build is throwing a runtime 500 internal server error:

Error while running `getDataFromTree` TypeError: Object(...) is not a function
    at App (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/app/.next/server/pages/_app.js:926:65)
    at d (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:33:498)
    at bb (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:16)
    at a.b.render (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:42:43)
    at a.b.read (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:41:83)
    at exports.renderToStaticMarkup (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:51:446)
    at /Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/@apollo/client/react/ssr/ssr.cjs.js:82:21
    at new Promise (<anonymous>)
    at process (/Users/joncursi/Sites/nextradata/mmdp/src/mmdp-app/node_modules/@apollo/client/react/ssr/ssr.cjs.js:80:16)

The stack trace is pretty unhelpful, as I can't infer much from it. Any ideas on this?

joncursi commented 3 years ago

_app.js:926:65 refers to this line:

Screen_Shot_2020-11-30_at_6_58_15_AM

Idk why an error would be thrown here, trying to render a <meta /> tag...

joncursi commented 3 years ago

This error appears to be related to React 17 and the next build command: https://github.com/vercel/next.js/issues/19001#issuecomment-732025307

Setting NODE_ENV=production before running next build as mentioned here seems to fix my issue.