adamsoffer/next-apollo

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

Closed this issue · 2 comments

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?

_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...

This error appears to be related to React 17 and the next build command: vercel/next.js#19001 (comment)

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