Darkbound
Darkbound

Reputation: 3434

Shopify React Next Cannot read property "/_app" of undefined

I am trying to setup an environment to develop a shopify theme, and I followed the tutorial found here:

https://shopify.dev/tutorials/build-a-shopify-app-with-node-and-react/build-your-user-interface-with-polaris

But when I connected my server, the app, the store and so on, when I started integrating polaris, on build I started getting errors.

First I had an error about a missing module build-manifest.json and I found a suggestion somewhere on the forums to make a blank file with just {} in it in the .next/ directory and so I did.

Then it complained about react-loadable-manifest.json missing, and I did the same for it.

Both of these errors were being thrown from this piece of code:

  server.use(async (ctx) => {
    await handle(ctx.req, ctx.res); // <-- this line
    ctx.respond = false;
    ctx.res.statusCode = 200;
    return;
  });

And now I have the following errors:

error - ./node_modules/@shopify/polaris/dist/styles.css
TypeError: Cannot read property 'tapAsync' of undefined
TypeError: Cannot read property '/_app' of undefined

Thats the full stack, I dont see any "custom" code related to it:

error - ./node_modules/@shopify/polaris/dist/styles.css
TypeError: Cannot read property 'tapAsync' of undefined
TypeError: Cannot read property '/_app' of undefined
    at getPageFiles (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\get-page-files.js:1:311)
    at getDocumentFiles (C:\Users\Darkbound\Desktop\shopifyreact\server\.next\server\pages\_document.js:266:54)
    at Head.render (C:\Users\Darkbound\Desktop\shopifyreact\server\.next\server\pages\_document.js:589:19)
    at processChild (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\react-dom\cjs\react-dom-server.node.development.js:3450:18)
    at resolve (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\react-dom\cjs\react-dom-server.node.development.js:3270:5)
    at ReactDOMServerRenderer.render (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\react-dom\cjs\react-dom-server.node.development.js:3753:22) 
    at ReactDOMServerRenderer.read (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\react-dom\cjs\react-dom-server.node.development.js:3690:29)   
    at renderToStaticMarkup (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\react-dom\cjs\react-dom-server.node.development.js:4314:27)
    at renderDocument (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\render.js:3:715)
    at renderToHTML (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\render.js:56:103)
    at async C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:107:97
    at async C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:100:142
    at async DevServer.renderToHTMLWithComponents (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:132:387)
    at async DevServer.renderErrorToHTML (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:134:327)    
    at async DevServer.render (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:72:236)
    at async Object.fn (C:\Users\Darkbound\Desktop\shopifyreact\server\node_modules\next\dist\next-server\server\next-server.js:56:580)

Upvotes: 0

Views: 843

Answers (1)

Zylth
Zylth

Reputation: 11

I came across this issue when jumping next multiple dependencies versions at once. I was able to resolve it by removing the wrapped Container https://github.com/vercel/next.js/blob/master/errors/app-container-deprecated.md

Upvotes: 1

Related Questions