Comments (11)
I've tried deleting the node_modules
and using npm
, but unfortunately the issue persists.
The versions I'm using are:
node
:18.4.0
pnpm
:7.5.0
npm
:8.12.1
I believe the problem is related to the way the app bundle is created. I've put together a dummy repo with Cloudflare Workers & faunadb
(https://github.com/mccuna/faunadb-cloudflare-worker) and it seems that:
- if
wrangler.toml
hasmain = src/index.ts
andwrangler
handles the bundling, then then a similar error occurs
X [ERROR] [plugin checkForNodeBuiltins] Detected a Node builtin module import while Node compatibility is disabled.
Add node_compat = true to your wrangler.toml file to enable Node compatibility.
node_modules/faunadb/src/_http/fetchAdapter.js:46:16:
46 │ : require('http')
╵ ~~~~~~
This error came from the "onResolve" callback registered here:
node_modules/wrangler/wrangler-dist/cli.js:121430:11:
121430 │ build6.onResolve({
- if
wrangler.toml
hasmain = "build/index.js"
and I bundle the worker myself usingesbuild
andformat:"esm"
. Then everything is ok
from faunadb-js.
Internal ticket number is FE-2503
from faunadb-js.
Which version of Node.js, npm
, and pnpm
are you running?
Since pnpm
tries to dedupe all of the Node modules installed on a system, you may be encountering a limitation where pnpm
cannot yet properly handle Node.js's "built-in" modules.
To test that theory, can you replace your pnpm
use with npm
? If that works, then it might be worth filing an issue with the pnpm
project.
from faunadb-js.
Facing the same error when using the latest fresh install of Remix with the target set as Cloudflare Workers.
from faunadb-js.
Same here, whatever options ES Build is using for Wrangler 2 is tripping over Fauna
from faunadb-js.
I notice that there is a PR that adds support for Cloudflare Module Workers. This PR has – sadly – not been merged yet.
Maybe this change will correct the problem with the Fauna driver?
from faunadb-js.
I am not sure, but it could be that this problem is two-fold. So to get the Fauna driver to work with Remix using Cloudflare Workers, two issues need to be addressed:
- Remix needs to use Cloudflare Module Worker and not Service Worker like today.
- Fauna needs to provide an EMS serverless driver like PlanetScale does.
from faunadb-js.
Still facing the same problem. Would be nice if there is at least some patch that we can add locally to make it work with wrangler2
from faunadb-js.
Have you tried to do with Remix and Cloudfare Pages? (not CF workers)
from faunadb-js.
No, my production application is built with cloudflare workers and also I want to make use of Service Bindings. So, moving to cloudflare pages is a no-go for me at this time.
I want to use service bindings which will only work with Wrangler2, but wrangler2 doesn’t work with Fauna.
from faunadb-js.
The latest version of Wrangler 2 (v2.9.1+) is compatible with the JS driver. But we are looking into what we can do to help with the fact that the default setup for Cloudflare and Remix is not working.
cc: @Shadid12
from faunadb-js.
Related Issues (20)
- provide internal function to "normalize" "data" result
- Property 'requestResult' does not exist on type 'typeof FaunaHTTPError'.
- invalid argument: Regular Class Ref expected, Schema Class Ref provided. HOT 3
- "invalid ref" when using `client.query( Create( Collection('test') ...` HOT 3
- UDF's not showing javascript variables HOT 2
- process.version & process.versions fail build on Vercel Edge API Route HOT 3
- Failing Queries from Cancelled Stream Error HOT 5
- Typechecking functions such as `IsString` should also null as a parameter (typescript typing issue) HOT 2
- 4.7.0 to 4.7.1 causes InvalidValue error when importing code HOT 5
- TypeError: faunadb.Client is not a constructor HOT 10
- Is it safe to expose the key in the browser? HOT 3
- Explictly set 'Content-Type': 'application/json' HOT 1
- OPTIONS xhr request before POST HOT 1
- PageHelper.nextPage() fails to handle the final page HOT 2
- PageHelper.nextPage() throws an error if `size` parameter is passed to `Client.paginate()` HOT 1
- what is the status of the ESM driver? HOT 2
- require('util') fails in some ESM configurations HOT 1
- "TypeError: Incorrect type for the 'signal' field on 'RequestInitializerDict': the provided value is not of type 'AbortSignal'." HOT 1
- Allow login, disable creating account HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faunadb-js.