Npm fauna results in SSR bundle failed when using netlify build

Hello all!

This is my first foray into using Fauna (using the current version, v10). My setup is with Gatsby / Netlify. If it’s relevant I’m using Sanity as my CMS. Node: 18.17.1 and npm: 9.6.7, but I’ve also tried Node: 20.11.0 and npm: 10.2.4.

My project is a simple web hook that validates an email from a form input then either adds the form data to a db for accepted or rejected entrants. While using netlify build to start testing, I get this error:

warn ./node_modules/fauna/dist/browser/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
warn ./node_modules/fauna/dist/browser/index.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
success Building production JavaScript and CSS bundles - 5.056s

 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:http2" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:http2


 ERROR #98123  WEBPACK.BUILD-HTML

Generating SSR bundle failed

Reading from "node:os" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

File: node:os

not finished Building HTML renderer - 3.400s


"build.command" failed                 

The error seems to indicate the need for an additional plugin for node:os and node:http2. But honestly, I’m not sure what that means. Has anyone else run into this issue or have insight into how I can correct this?

Update: I’ve switched over to the faunadb npm package (and accordingly switched my syntax to v4) and I’m no longer getting the build error.

At some point, I know I would have to switch this to v10 anyway so I would like to just start with v10, if possible.

Hi @EricPhifer and welcome! :wave:

We are trying to do some dependency gymnastics to support browsers, node, as well as other runtimes. Clearly this is causing some issues with webpack for you.

Can you tell us are you using the default webpack setup for Gatsby? I am not familiar with how to bootstrap a Gatsby project (I did once like 8 years ago).

We have a related existing GitHub issue about this. But in that one, those warnings only happened in hot-module-reload for the dev server and building was not an issue. I’ve posted this info there for cross reference.

@ptpaterson Thanks for letting me know! Yes, I’m using the default Gatsby web pack.

Let me know if there’s any additional information I can provide that will help you all.