Comments (4)
Created a workaround. It ain't pretty, but it's available here:
https://github.com/j1mmie/fireway
It works by shimming the crypto
module's randomBytes
method. The shimmed version does not dispatch RANDOMBYTESREQUEST
hooks, but still strives to be cryptographically secure.
Firestore's client library uses the autoid
function (which calls randomBytes
) to attach a tag to every network request. That's why it gets called even in get
and so forth. It also uses autoid
when creating a random document id. So if you're at all concerned about these tags/ids being cryptographically secure, then I would not use my hack. Initial entropy is obtained from the crypto module itself. And the PRNG comes from best practices by hash/prng guru @bryc. But I am in no way qualified to offer any sort of guarantee.
My fork also fixes an issue with forceAwait not working, and adds a 30 second timeout to it. It might possibly resolve this: #51
from fireway.
Same here. Happens with batches too.
Node version: v16.20.0
Fireway SHA: master (ed478ff)
from fireway.
+1
Interesting that hard-coding the docID
works:
module.exports.migrate = async ({ firestore, FieldValue, FieldPath }) => {
await firestore.collection('test').doc('foo').set({key: 'value'})
}
But as reported by @bradleesand, any other variation fails.
from fireway.
Made some headway on this issue:
- Found out that Firestore's internal method,
autoid
, is the culprit. It calls crypto.randomBytes, which is reporting an open async call but not reporting that it is closed. - Found a similar issue in Jest: uuidjs/uuid#566
- The issue was resolved in Jest here: https://github.com/jestjs/jest/pull/11278/files. It simply checks the type of async hook that is triggered, and ignores type
RANDOMBYTESREQUEST
I tried applying a similar fix to Fireway, but for some reason the async hook for the get
promise (or whichever method is used) gets lumped into the same async hook as the randomBytes promise. I can't find a way to both safely detect open-async calls and ignore RANDOMBYTESREQUEST
calls.
I'll continue looking for workarounds / fixes.
from fireway.
Related Issues (20)
- Don't understand how to use this tool. HOT 3
- trouble running document *field* deletion migrations HOT 2
- How to run a specific migration file? HOT 5
- Running migrations with '--dryrun' modifies the db sometimes. HOT 9
- Running locally doesn't read/write the latest data HOT 10
- Please document how to debug migrations (both .js and .ts) HOT 1
- How to access admin.auth()? HOT 10
- Configure Firestore Settings throws error HOT 2
- comparison
- yarn fails on Apple silicon with Node 16.
- Reverse migrations HOT 3
- Noisy migrations HOT 2
- Problem with forceWait HOT 1
- How to run migrations in Github Actions using firebase token? HOT 7
- Install rank just has "1" appended to it when it should be incremented HOT 1
- fireway requiring projectId while running against firebase emulator HOT 1
- upgrade dependencies HOT 1
- Add CLI flag or environment variable for specifying firestore collection for migration records
- Need Support for ES6 Module -> (Error [ERR_REQUIRE_ESM]: require() of ES Module)
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 fireway.