birdofpreyru / react-global-state

Efficient and simple to use global state management for React, implemented with hooks, and spiced by useful data management functions (async retreival, caching, etc.)
https://dr.pogodin.studio/docs/react-global-state/index.html
Other
1 stars 0 forks source link

Any 'gotchas' on when integrating into a NextJS SSR environment? #35

Closed CharlestonREM closed 3 years ago

CharlestonREM commented 3 years ago

I am going to be using this on a test page in a small remote app I am currently developing. I have continuous integration setup through git to push to a remote server with Vercel.

Curious if you are aware of any problems associated with SSR and NextJS.

CharlestonREM commented 3 years ago

Setup in NextJS

i'm trying to set up in a NextJS environment

referencing your blog post

image

NextJS - _app.tsx

image

Testing with a async data attempt page

image

remote url of initial setup (more to come)

https://medsy-minimal-test-6o1hd7s62-charlestonrem.vercel.app/global-state-google-test

CharlestonREM commented 3 years ago

typescript error in _app.tsx setup attempt

image

error regarding async function in _app.tsx

image

CharlestonREM commented 3 years ago

accidental close :)

CharlestonREM commented 3 years ago

attempt at advanced setup from this page.

import React from 'react';

import { GlobalStateProvider } from '@dr.pogodin/react-global-state';

import { CartProvider } from 'contexts/cart/cart.provider';
import { DrawerProvider } from 'contexts/drawer/drawer.provider';
import { ModalProvider } from 'contexts/modal/modal.provider';
import { StickyProvider } from 'contexts/sticky/sticky.provider';
import { SearchProvider } from 'contexts/search/use-search';

import { AppBar, Box, Container, CssBaseline, ThemeProvider, Toolbar, Typography } from '@material-ui/core';
import { AppProps } from 'next/app';
import Head from 'next/head';
import { theme } from 'theme';
import { StepperProvider } from 'contexts/stepper/stepper.provider';
import { CalculatorProvider } from 'contexts/calculator/calculator.provider'
import { AvailableProductsProvider } from 'contexts/available-products/available-products.provider';

export default async function CustomApp({ Component, pageProps }: AppProps) {

  React.useEffect(() => {

    const jssStyles = document.querySelector('#jss-server-side');
    if (jssStyles) {
      jssStyles.parentElement.removeChild(jssStyles);
    }
  }, []);

  let render;
  let round = 0;
  const ssrContext = { state: {} };

  for (let round = 0; round < 3; round += 1) {
    render = (

      <GlobalStateProvider
        initialState={ssrContext.state}
        ssrContext={ssrContext}
      >

        <ThemeProvider theme={theme}>

          <CssBaseline />
          <SearchProvider>
            <StickyProvider>
              <DrawerProvider>
                <StepperProvider>
                  <AvailableProductsProvider>
                    <CalculatorProvider>
                      <ModalProvider>
                        <CartProvider>
                          <Component {...pageProps} />
                        </CartProvider>
                      </ModalProvider>
                    </CalculatorProvider>
                  </AvailableProductsProvider>
                </StepperProvider>
              </DrawerProvider>
            </StickyProvider>
          </SearchProvider>
        </ThemeProvider>
      </GlobalStateProvider>
    );
    if (ssrContext.dirty) {
      await Promise.allSettled(ssrContext.pending);
    } else break;
  }
  return { render, state: ssrContext.state };

}

image

CharlestonREM commented 3 years ago

errors

In advanced setup attempt I get the following error in development:

Server Error
Error: Objects are not valid as a React child (found: [object Promise]). If you meant to render a collection of children, use an array instead.

This error happened while generating the page. Any console logs will be displayed in the terminal window.

attempting research

CharlestonREM commented 3 years ago

abandoning complex setup for now, trying simple

import React from 'react'
import { Typography } from '@material-ui/core'

import {
    useAsyncData,
    useGlobalState,
} from '@dr.pogodin/react-global-state';

/* Example of component relying on the global state. */

function SampleComponent() {
    const [value, setValue] = useGlobalState('sample.component', 0);
    return (
        <div>
            <h1>`SampleComponent`</h1>
            <button onClick={() => setValue(1 + value)}>
                {value}
            </button>
        </div>
    );
}

/* Example of component relying on async data in the global state. */

async function sampleDataLoader() {
    return new Promise((resolve) => {
        setTimeout(() => resolve(<Typography variant="h2">I am sample data</Typography>), 900);
    });
}

function SampleAsyncComponent() {
    const { data, loading } = useAsyncData('sample.async-component', sampleDataLoader);
    return data;
}

export interface GlobalStateGoogleTestProps {

}

const GlobalStateGoogleTest: React.FC<GlobalStateGoogleTestProps> = () => {
    return (
        <React.Fragment>
            <div>
                <h1>Global State Google Test</h1>
            </div>
            <SampleComponent />
            <SampleAsyncComponent />
        </React.Fragment>
    );
}

export default GlobalStateGoogleTest;
birdofpreyru commented 3 years ago

Hi @CharlestonREM, it is great to know somebody got interested to give it a try!

So far I have not tried to use this library in any other React setup beside my custom one, but I don't expect it to have any significant issue within NextJS, or any other alternative.

Going through your message in this thread.

Property dirty does not exist on type '{ state: {}; }'.

I guess, it should be fixed if you replace the initialization const ssrContext = { state: {} }; in the setup instructions by const ssrContext = { state: {}, dirty: false }; - this way TypeScript should figure out that dirty is a valid boolean field, and should not throw error when you check it.

The example from you last message looks kind of fine, but it misses <GlobalStateProvider> which should wrap entire app (or at least any components which rely on global state hooks).

And in your snipplet of advanced setup, the problem should be that CustomApp function is intended to be a React component (judging by the use of React.useEffect inside it), but all that re-renders in advanced setup should be done outside the React tree. In the example given in library README

async function renderServerSide() {
  let render;
  const ssrContext = { state: {} };
  for (let round = 0; round < 3; round += 1) {
    render = ReactDOM.renderToString((
      <GlobalStateProvider
        initialState={ssrContext.state}
        ssrContext={ssrContext}
      >
        <SampleApp />
      </GlobalStateProvider>
    ));
    if (ssrContext.dirty) {
      await Promise.allSettled(ssrContext.pending);
    } else break;
  }
  return { render, state: ssrContext.state };
}

the renderServerSide() function itself is not a React component, that's why it calls ReactDOM.renderToString(..) to do the actual server-side rendering. And the stuff it returns, render is just a plain-text HTML you can serve to the client, and the ssrContext.state is the initial value of global state to use at the client side.

birdofpreyru commented 3 years ago

It might be helpful to check the actual way I use it inside my SSR setup: https://github.com/birdofpreyru/react-utils/blob/master/src/server/renderer.jsx#L107-L288 there is a lot of additional stuff going on, but on the high level these lines are just ExpressJS middleware which uses ReactJS to perform SSR, and send to the client generated HTML. And specifically on the lines 132-161, if App is the ReactJS component, representing the App, it does multiple rendering passes with ReactDOM.renderToString(..) to generate the markup.

birdofpreyru commented 3 years ago

And on the client side I use a different code to initialize the app: https://github.com/birdofpreyru/react-utils/blob/8c77e288b994ce214ca9e7bcfa52a065e7cbbbc6/src/client/index.jsx#L33-L54

birdofpreyru commented 3 years ago

I'll probably will try to setup it with NextJS later tonight, and update the setup instructions accordingly.

birdofpreyru commented 3 years ago

Hey @CharlestonREM , here is my first try with simple setup for NextJS: https://github.com/birdofpreyru/react-global-state-with-next

I just added <GlobalStateProvider> wrapper into custom App: https://github.com/birdofpreyru/react-global-state-with-next/blob/main/pages/_app.js and it makes the global state hooks functional, as demonstrated by this simple demo page: https://github.com/birdofpreyru/react-global-state-with-next/blob/main/pages/global-state-example.js note that if you bump the value by pressing the button there, the value is correctly persistent across page transitions from/to the home page, as long as these transitions are done with next/link (I added such link as the first card at the home page), or browser previous/next buttons.

As for the advanced setup, to hook asynchronous data fetching by global state into NextJS, I don't have time to try it carefully right now, but at the first glance it seems that it should be done with NextJS's custom server: https://nextjs.org/docs/advanced-features/custom-server I guess something like this should do (combining the example from NextJS documentation, with my advanced setup code):

// server.js
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

app.prepare().then(() => {
  createServer((req, res) => {
    // Be sure to pass `true` as the second argument to `url.parse`.
    // This tells it to parse the query portion of the URL.
    const parsedUrl = parse(req.url, true)
    const { pathname, query } = parsedUrl

    const ssrContext = { state: {}, dirty: false };
    for (let round = 0; round < 3; round += 1) {
      // TODO: I guess, then you can take this state value inside App code
      // (probably inside App.getInitialProps) and pass it into initialState
      // prop of GlobalStateProvider
      req.initGlobalState = ssrContext.state;

      // TODO: And here, instead of passing in res object, we need some
      // "proxy" object which allows to ignore the rendering result. This way,
      // if `ssrContext.dirty` is true after this operation, we just go to
      // the next rendering iteration, otherwise we break the loop and actually
      // send the render result to the client.
      app.render(req, res, pathname, query);

      if (ssrContext.dirty) {
        await Promise.allSettled(ssrContext.pending);
      } else break;
    }

    // TODO: Actually send to the client the response created by
    // app.render in the last rendering cycle above.

  }).listen(3000, (err) => {
    if (err) throw err
    console.log('> Ready on http://localhost:3000')
  })
})
CharlestonREM commented 3 years ago

you are awesome! trying out your example repo:

This was on initial load after installing your repo example and running yarn dev:

image

fixed locally!

I fixed it by commenting out your <a></a> that was nested in the wrapping <a className={styles.card}></a>

image

deployed it on vercel

I use vercel for deployment. It works! Here is the link: https://react-global-state-with-next.vercel.app/

CharlestonREM commented 3 years ago

it appears custom server approach is a no go for vercel

image

Hey @CharlestonREM , here is my first try with simple setup for NextJS: https://github.com/birdofpreyru/react-global-state-with-next

I just added <GlobalStateProvider> wrapper into custom App: https://github.com/birdofpreyru/react-global-state-with-next/blob/main/pages/_app.js and it makes the global state hooks functional, as demonstrated by this simple demo page: https://github.com/birdofpreyru/react-global-state-with-next/blob/main/pages/global-state-example.js note that if you bump the value by pressing the button there, the value is correctly persistent across page transitions from/to the home page, as long as these transitions are done with next/link (I added such link as the first card at the home page), or browser previous/next buttons.

As for the advanced setup, to hook asynchronous data fetching by global state into NextJS, I don't have time to try it carefully right now, but at the first glance it seems that it should be done with NextJS's custom server: https://nextjs.org/docs/advanced-features/custom-server I guess something like this should do (combining the example from NextJS documentation, with my advanced setup code):

// server.js
const { createServer } = require('http')
const { parse } = require('url')
const next = require('next')

const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

app.prepare().then(() => {
  createServer((req, res) => {
    // Be sure to pass `true` as the second argument to `url.parse`.
    // This tells it to parse the query portion of the URL.
    const parsedUrl = parse(req.url, true)
    const { pathname, query } = parsedUrl

    const ssrContext = { state: {}, dirty: false };
    for (let round = 0; round < 3; round += 1) {
      // TODO: I guess, then you can take this state value inside App code
      // (probably inside App.getInitialProps) and pass it into initialState
      // prop of GlobalStateProvider
      req.initGlobalState = ssrContext.state;

      // TODO: And here, instead of passing in res object, we need some
      // "proxy" object which allows to ignore the rendering result. This way,
      // if `ssrContext.dirty` is true after this operation, we just go to
      // the next rendering iteration, otherwise we break the loop and actually
      // send the render result to the client.
      app.render(req, res, pathname, query);

      if (ssrContext.dirty) {
        await Promise.allSettled(ssrContext.pending);
      } else break;
    }

    // TODO: Actually send to the client the response created by
    // app.render in the last rendering cycle above.

  }).listen(3000, (err) => {
    if (err) throw err
    console.log('> Ready on http://localhost:3000')
  })
})
CharlestonREM commented 3 years ago

<GlobalStateProvider></GlobalStateProvider> is resulting in 500 INTERNAL SERVER ERROR vercel deploy

I am confused because your simple example works on vercel. I am wondering if the error is typescript related. Here is the error:

image

Here is my _app.tsx file: image

CharlestonREM commented 3 years ago

typescript implementation error

image

CharlestonREM commented 3 years ago

Build Log from server error on vercel

07:44:41.632    Cloning github.com/CharlestonREM/MedsyPurchase (Branch: main, Commit: 36e381c)
07:44:42.167    Cloning completed in 535ms
07:44:42.174    Analyzing source code...
07:44:42.738    Installing build runtime...
07:44:45.565    Build runtime installed: 2826.249ms
07:44:48.290    Looking up build cache...
07:44:48.668    Build cache found. Downloading...
07:44:53.076    Build cache downloaded [49.19 MB]: 4407.268ms
07:44:54.103    Installing dependencies...
07:44:54.462    yarn install v1.22.10
07:44:54.500    info No lockfile found.
07:44:54.517    [1/4] Resolving packages...
07:44:56.069    warning mailgen > juice > web-resource-inliner > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
07:44:56.218    warning mailgen > juice > web-resource-inliner > request > har-validator@5.1.5: this library is no longer supported
07:44:57.005    warning next > mkdirp@0.5.3: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
07:44:57.612    warning next > chokidar > fsevents@2.1.3: "Please update to latest v2.3 or v2.2"
07:44:57.869    warning next > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
07:44:57.876    warning next > webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
07:44:58.430    warning next > resolve-url-loader > rework > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
07:44:58.437    warning next > resolve-url-loader > rework > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
07:44:58.627    warning next > resolve-url-loader > rework > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
07:44:59.113    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi@15.1.1: Switch to 'npm install joi'
07:44:59.113    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
07:44:59.119    warning next-pwa > workbox-webpack-plugin > workbox-build > rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
07:44:59.285    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
07:44:59.298    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
07:44:59.299    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/topo > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
07:44:59.307    warning next-pwa > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
07:44:59.390    warning next-pwa > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
07:45:02.771    [2/4] Fetching packages...
07:45:23.679    warning url-loader@1.1.2: Invalid bin field for "url-loader".
07:45:41.291    info fsevents@2.1.3: The platform "linux" is incompatible with this module.
07:45:41.291    info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
07:45:41.291    info fsevents@2.3.2: The platform "linux" is incompatible with this module.
07:45:41.291    info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
07:45:41.291    info fsevents@1.2.13: The platform "linux" is incompatible with this module.
07:45:41.291    info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
07:45:41.295    [3/4] Linking dependencies...
07:45:41.305    warning " > @material-ui/pickers@3.2.10" has unmet peer dependency "@date-io/core@^1.3.6".
07:45:41.305    warning " > @material-ui/pickers@3.2.10" has unmet peer dependency "prop-types@^15.6.0".
07:45:41.305    warning " > @material-ui/pickers@3.2.10" has incorrect peer dependency "react@^16.8.4".
07:45:41.305    warning " > @material-ui/pickers@3.2.10" has incorrect peer dependency "react-dom@^16.8.4".
07:45:41.306    warning " > formik-material-ui@3.0.1" has unmet peer dependency "tiny-warning@>=1.0.2".
07:45:41.306    warning " > formik-material-ui-lab@0.0.8" has unmet peer dependency "tiny-warning@>=1.0.2".
07:45:41.316    warning "next-optimized-images > file-loader@3.0.1" has unmet peer dependency "webpack@^4.0.0".
07:45:41.316    warning "next-optimized-images > url-loader@1.1.2" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
07:45:41.316    warning "next-optimized-images > raw-loader@2.0.0" has unmet peer dependency "webpack@^4.3.0".
07:45:41.316    warning " > next-pwa@3.1.5" has unmet peer dependency "webpack@>=4.0.0".
07:45:41.317    warning "next-pwa > workbox-webpack-plugin@5.1.4" has unmet peer dependency "webpack@^4.0.0".
07:45:41.317    warning "next-pwa > clean-webpack-plugin@3.0.0" has unmet peer dependency "webpack@*".
07:45:41.318    warning " > overlayscrollbars-react@0.2.2" has incorrect peer dependency "react@^16.4.0".
07:45:41.319    warning " > react-stickynode@3.0.4" has incorrect peer dependency "react@^0.14.2 || ^15.0.0 || ^16.0.0".
07:45:41.319    warning " > react-stickynode@3.0.4" has incorrect peer dependency "react-dom@^0.14.2 || ^15.0.0 || ^16.0.0".
07:45:41.319    warning " > react-waypoint@9.0.3" has incorrect peer dependency "react@^15.3.0 || ^16.0.0".
07:45:41.319    warning " > babel-plugin-inline-react-svg@1.1.2" has unmet peer dependency "@babel/core@^7.0.0".
07:46:02.722    [4/4] Building fresh packages...
07:46:05.149    success Saved lockfile.
07:46:05.155    Done in 70.70s.
07:46:05.240    Running "yarn run build"
07:46:05.600    yarn run v1.22.10
07:46:05.651    $ next build
07:46:06.518    Browserslist: caniuse-lite is outdated. Please run:
07:46:06.519    npx browserslist@latest --update-db
07:46:06.662    info  - Creating an optimized production build...
07:46:24.663    info  - Using external babel configuration from /vercel/workpath0/babel.config.js
07:46:36.716    info  - Compiled successfully
07:46:36.717    info  - Collecting page data...
07:46:38.956    info  - Generating static pages (0/4)
07:46:40.356    info  - Generating static pages (1/4)
07:46:40.392    info  - Generating static pages (2/4)
07:46:40.397    info  - Generating static pages (3/4)
07:46:40.401    info  - Generating static pages (4/4)
07:46:40.402    info  - Finalizing page optimization...
07:46:40.430    Page                                                           Size     First Load JS
07:46:40.430    ┌ λ /                                                          29.6 kB         212 kB
07:46:40.430    ├   /_app                                                      0 B             129 kB
07:46:40.430    ├ ○ /404                                                       3.45 kB         133 kB
07:46:40.431    ├ λ /api/order                                                 0 B             129 kB
07:46:40.431    ├ λ /api/postData                                              0 B             129 kB
07:46:40.431    ├ λ /crem                                                      75.1 kB         266 kB
07:46:40.431    ├ ○ /faq                                                       7.86 kB         190 kB
07:46:40.431    ├ ○ /global-state-google-test                                  323 B           130 kB
07:46:40.431    ├ λ /old-crem                                                  5.16 kB         196 kB
07:46:40.431    └ ○ /terms                                                     27.5 kB         213 kB
07:46:40.431    + First Load JS shared by all                                  129 kB
07:46:40.431      ├ chunks/1672a26b96b71dceb009bacd6bc35a374475cfb1.ffbe67.js  3.71 kB
07:46:40.431      ├ chunks/29107295.221cec.js                                  24.7 kB
07:46:40.431      ├ chunks/8e3135e6c3df04dae4d618aa270a95f59d988762.0a836e.js  2.46 kB
07:46:40.432      ├ chunks/95f25e6260e3815c917344dc2479235c756b0d06.888c9d.js  9.17 kB
07:46:40.432      ├ chunks/a9016302f96ebb0872beecb250153a0bc915ba4b.54f045.js  10.2 kB
07:46:40.432      ├ chunks/efe40f5d0bf0d4f5599c872a58a23f7917960946.26daff.js  19.3 kB
07:46:40.432      ├ chunks/framework.6e845a.js                                 42.1 kB
07:46:40.432      ├ chunks/main.ceb8d3.js                                      7.3 kB
07:46:40.432      ├ chunks/pages/_app.7e188f.js                                9.77 kB
07:46:40.432      └ chunks/webpack.e06743.js                                   751 B
07:46:40.432    λ  (Lambda)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
07:46:40.432    ○  (Static)  automatically rendered as static HTML (uses no initial props)
07:46:40.432    ●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
07:46:40.432       (ISR)     incremental static regeneration (uses revalidate in getStaticProps)
07:46:40.626    Done in 35.03s.
07:46:54.335    Traced Next.js serverless functions for external files in: 13660.939ms
07:46:57.361    Compressed shared serverless function files: 3024.919ms
07:46:57.719    All serverless functions created in: 357.793ms
07:46:58.692    Uploading build outputs...
07:47:06.316    Build completed. Populating build cache...
CharlestonREM commented 3 years ago

function error related to @dr.pogodin/react-global-state/index.js

image

[HEAD] /
07:47:19:13
Status:
-1
Duration:
1162.25 ms
Init Duration:
N/A
Memory Used:
56 MB
ID:
plsjc-1615294039063-2f22bc28d8a0
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:20.291Z    4231c153-e081-4c70-bb41-5a7735fbf284    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:20.292Z    4231c153-e081-4c70-bb41-5a7735fbf284    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[HEAD] /
07:47:15:80
Status:
-1
Duration:
1133.00 ms
Init Duration:
N/A
Memory Used:
55 MB
ID:
gdg9v-1615294035798-eaa3b2e15c61
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:16.931Z    0b60b857-4821-4f88-8662-548ed35f4c86    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:16.932Z    0b60b857-4821-4f88-8662-548ed35f4c86    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[HEAD] /
07:47:13:60
Status:
-1
Duration:
1093.95 ms
Init Duration:
N/A
Memory Used:
51 MB
ID:
gdg9v-1615294033574-be31616675d0
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:14.692Z    0220b7e1-b0c6-40e5-b4b9-ff1925a1a199    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:14.692Z    0220b7e1-b0c6-40e5-b4b9-ff1925a1a199    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[HEAD] /
07:47:12:90
Status:
-1
Duration:
1146.36 ms
Init Duration:
N/A
Memory Used:
55 MB
ID:
tbl84-1615294032887-6690bc508b25
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:14.084Z    83d1f639-aaf6-4e74-b92a-f3d9e6e552c8    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:14.084Z    83d1f639-aaf6-4e74-b92a-f3d9e6e552c8    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:12:39
Status:
-1
Duration:
1157.67 ms
Init Duration:
N/A
Memory Used:
54 MB
ID:
7lcqv-1615294032391-9c3e8a2a766c
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:13.551Z    37766e1a-6b05-4c47-9b6d-742863f89517    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:13.552Z    37766e1a-6b05-4c47-9b6d-742863f89517    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[HEAD] /
07:47:10:38
Status:
-1
Duration:
1150.08 ms
Init Duration:
N/A
Memory Used:
56 MB
ID:
sqzgw-1615294030344-308f555e3d93
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:11.560Z    c4d70486-05ea-4798-a956-66bf18afe318    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:11.560Z    c4d70486-05ea-4798-a956-66bf18afe318    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:09:17
Status:
-1
Duration:
1177.62 ms
Init Duration:
N/A
Memory Used:
55 MB
ID:
n5bmx-1615294029153-a68fa8cde285
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:10.349Z    8e9b6fe0-fb46-47ca-8b4c-35b65ace8444    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:10.359Z    8e9b6fe0-fb46-47ca-8b4c-35b65ace8444    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:08:39
Status:
-1
Duration:
1172.29 ms
Init Duration:
N/A
Memory Used:
55 MB
ID:
mj9j2-1615294028393-6affc4c0f442
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:09.601Z    91668807-42bc-4a11-9e7a-7b275204626f    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:09.610Z    91668807-42bc-4a11-9e7a-7b275204626f    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:06:69
Status:
-1
Duration:
1207.64 ms
Init Duration:
137.72 ms
Memory Used:
110 MB
ID:
7lcqv-1615294026655-b12af38e476a
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:08.103Z    911a3fe3-147b-4f4a-b248-d0b7c0a99b12    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:08.103Z    911a3fe3-147b-4f4a-b248-d0b7c0a99b12    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:05:74
Status:
-1
Duration:
1275.39 ms
Init Duration:
156.88 ms
Memory Used:
110 MB
ID:
chg9l-1615294025501-a3c4c859fdac
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:07.333Z    5c9b31a7-dd7e-4651-92bc-aec73a35347d    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:07.333Z    5c9b31a7-dd7e-4651-92bc-aec73a35347d    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
[GET] /
07:47:05:71
Status:
-1
Duration:
1210.91 ms
Init Duration:
141.74 ms
Memory Used:
109 MB
ID:
gnx6w-1615294025350-6e9fbd5b705a
User Agent:
Vercelbot/0.1 (+https://vercel.com)
2021-03-09T12:47:07.225Z    bc09f79c-505e-4617-8f1d-6abcf35e7a54    ERROR   Unhandled error during request: Error: Cannot find module './build/node'
Require stack:
- /var/task/node_modules/@dr.pogodin/react-global-state/index.js
- /var/task/.next/serverless/pages/index.js
- /var/task/now__launcher.js
- /var/runtime/UserFunction.js
- /var/runtime/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
    at Function.Module._load (internal/modules/cjs/loader.js:667:27)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/task/node_modules/@dr.pogodin/react-global-state/index.js',
    '/var/task/.next/serverless/pages/index.js',
    '/var/task/now__launcher.js',
    '/var/runtime/UserFunction.js',
    '/var/runtime/index.js'
  ]
}
2021-03-09T12:47:07.225Z    bc09f79c-505e-4617-8f1d-6abcf35e7a54    ERROR   Uncaught Exception  {"errorType":"Error","errorMessage":"Cannot find module './build/node'\nRequire stack:\n- /var/task/node_modules/@dr.pogodin/react-global-state/index.js\n- /var/task/.next/serverless/pages/index.js\n- /var/task/now__launcher.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js","code":"MODULE_NOT_FOUND","requireStack":["/var/task/node_modules/@dr.pogodin/react-global-state/index.js","/var/task/.next/serverless/pages/index.js","/var/task/now__launcher.js","/var/runtime/UserFunction.js","/var/runtime/index.js"],"stack":["Error: Cannot find module './build/node'","Require stack:","- /var/task/node_modules/@dr.pogodin/react-global-state/index.js","- /var/task/.next/serverless/pages/index.js","- /var/task/now__launcher.js","- /var/runtime/UserFunction.js","- /var/runtime/index.js","    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)","    at Function.Module._load (internal/modules/cjs/loader.js:667:27)","    at Module.require (internal/modules/cjs/loader.js:887:19)","    at require (internal/modules/cjs/helpers.js:74:18)","    at Object.<anonymous> (/var/task/node_modules/@dr.pogodin/react-global-state/index.js:10:20)","    at Module._compile (internal/modules/cjs/loader.js:999:30)","    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)","    at Module.load (internal/modules/cjs/loader.js:863:32)","    at Function.Module._load (internal/modules/cjs/loader.js:708:14)","    at Module.require (internal/modules/cjs/loader.js:887:19)"]}
Unknown application error occurred
birdofpreyru commented 3 years ago

it appears custom server approach is a no go for vercel

Yeah. Thus, it looks like with Vercel there is no way to hook the async data fetching by react-global-state into SSR. The best you can do is to manually pre-fetch needed data inside .getInitialProps(..) and similar functions, and use that to construct a good initial global state for <GlobalStateProvider>, but that largerly defeat the purpose of my useAsyncData(..) hook, which was exactly to avoid such manual pre-fetching for SSR, and instead leave it to the library to automatically pre-load such data at cost of a few additional re-renders of the page at the server side.

Regarding the errors, I am not completely sure, but from the first error message it looks like it just won't compile with a library lacking Typescript definitions (which I don't have written currently, as I don't use TS). And later logs saying it was not able to find the library, probably for the same reason, of lacking TS definitions?