Thank you for your reactivity!
Redeploying led me to an issue I didn’t have previously:
3:53:55 PM: The function "SERVER" is larger than the 50MB limit. Please consider reducing it.
3:53:55 PM: Failed to upload file: server
Following what I found in the doc/forum, I’ve added these lines to my netlify.toml
:
[functions]
node_bundler = "esbuild"
I then had this warning:
4:03:51 PM: ❯ The following Node.js modules use dynamic expressions to include files:
4:03:51 PM: - @remix-run/react
4:03:51 PM: - @sentry/remix
4:03:51 PM:
4:03:51 PM: Because files included with dynamic expressions aren't bundled with your serverless functions by default,
this may result in an error when invoking a function. To resolve this error, you can mark these Node.js
4:03:51 PM: modules as external in the [functions] section of your `netlify.toml` configuration file:
4:03:51 PM:
4:03:51 PM: [functions]
4:03:51 PM: external_node_modules = ["@remix-run/react", "@sentry/remix"]
4:03:51 PM:
4:03:51 PM: Visit https://ntl.fyi/dynamic-imports for more information.
I’ve updated the toml accordingly:
[functions]
node_bundler = "esbuild"
external_node_modules = ["@remix-run/react", "@sentry/remix"]
The deploy worked. But I have no clue why I have to do that, and the app is broken. This is the function log:
Mar 22, 04:08:51 PM: ec025797 ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.Mar 22, 04:08:51 PM: ec025797 ERROR TypeError: Cannot read properties of null (reading 'useContext')
at Object.useContext (/var/task/node_modules/react/cjs/react.development.js:1618:21)
at useInRouterContext (/var/task/node_modules/react-router/lib/hooks.tsx:85:16)
at Router (/var/task/node_modules/react-router/lib/components.tsx:308:6)
at renderWithHooks (/var/task/.netlify/functions-internal/server.js:37505:25)
at renderIndeterminateComponent (/var/task/.netlify/functions-internal/server.js:37562:23)
at renderElement (/var/task/.netlify/functions-internal/server.js:37718:15)
at renderNodeDestructiveImpl (/var/task/.netlify/functions-internal/server.js:37822:17)
at renderNodeDestructive (/var/task/.netlify/functions-internal/server.js:37802:22)
at renderContextProvider (/var/task/.netlify/functions-internal/server.js:37695:11)
at renderElement (/var/task/.netlify/functions-internal/server.js:37762:17)Mar 22, 04:08:51 PM: ec025797 ERROR Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.Mar 22, 04:08:51 PM: ec025797 ERROR TypeError: Cannot read properties of null (reading 'useContext')
at Object.useContext (/var/task/node_modules/react/cjs/react.development.js:1618:21)
at useInRouterContext (/var/task/node_modules/react-router/lib/hooks.tsx:85:16)
at Router (/var/task/node_modules/react-router/lib/components.tsx:308:6)
at renderWithHooks (/var/task/.netlify/functions-internal/server.js:37505:25)
at renderIndeterminateComponent (/var/task/.netlify/functions-internal/server.js:37562:23)
at renderElement (/var/task/.netlify/functions-internal/server.js:37718:15)
at renderNodeDestructiveImpl (/var/task/.netlify/functions-internal/server.js:37822:17)
at renderNodeDestructive (/var/task/.netlify/functions-internal/server.js:37802:22)
at renderContextProvider (/var/task/.netlify/functions-internal/server.js:37695:11)
at renderElement (/var/task/.netlify/functions-internal/server.js:37762:17)Mar 22, 04:08:51 PM: ec025797 ERROR TypeError: Cannot read properties of null (reading 'useContext')
at Object.useContext (/var/task/node_modules/react/cjs/react.development.js:1618:21)
at useInRouterContext (/var/task/node_modules/react-router/lib/hooks.tsx:85:16)
at Router (/var/task/node_modules/react-router/lib/components.tsx:308:6)
at renderWithHooks (/var/task/.netlify/functions-internal/server.js:37505:25)
at renderIndeterminateComponent (/var/task/.netlify/functions-internal/server.js:37562:23)
at renderElement (/var/task/.netlify/functions-internal/server.js:37718:15)
at renderNodeDestructiveImpl (/var/task/.netlify/functions-internal/server.js:37822:17)
at renderNodeDestructive (/var/task/.netlify/functions-internal/server.js:37802:22)
at renderContextProvider (/var/task/.netlify/functions-internal/server.js:37695:11)
at renderElement (/var/task/.netlify/functions-internal/server.js:37762:17)Mar 22, 04:08:51 PM: ec025797 Duration: 258.61 ms Memory Usage: 220 MB
Is Remix supported by Netlify?