fauna / fauna-shell Goto Github PK
View Code? Open in Web Editor NEWInteractive shell for FaunaDB
License: Other
Interactive shell for FaunaDB
License: Other
I have my Fauna database secret keys stored in a secrets storage solution. In this case I use AWS Secrets Manager, but I could see this applying to other solutions such as Vault. It would be useful in a CI/CD or even local development environment to be able to define a script to grab the relevant secret required for the fauna shell session.
I imagine this would be like some kind of hook tied into either the $HOME/.fauna-shell
configuration file or the new project configuration file. Those configuration files could point to a JS script to be used to grab the secret key authentication for the endpoint. In my CI/CD environments and local environments I have the required AWS credentials files already set up to allow for retrieving the secret.
My current workaround plan is to run a script in CI/CD to grab the secret from AWS Secrets Manager and then write that out to a temporary fauna-shell configuration file.
test test
We need this, because currently fauna shell does not exit with error
Originally posted by @aprilmintacpineda in #158 (comment)
test test
Hello,
I installed fauna shell and tried to add a new endpoint and when I run the command it gives this error: Error: Error: connect ECONNREFUSED 127.0.0.1:8433
I use Windows and I have run this command in cmd and PowerShell also.
I am not sure if this error has to do with fauna shell or some windows configuration but I would appreciate if you have any idea how to debug or fix this.
Thanks!
I don't see there such a command, but I'd like to be able to upload with with the cli.
There's already some work done on VSCode extension side:
Now that run-queries
is an alias for eval
, it ignores dbname
. I know this command is deprecated but this is now a busted command with incorrect documentation.
I'm guessing the fix for this is just removing run-queries
, but that doesn't support a dbname argument sadly.
test test 123
Hello,
The crashes happen once I type the . to fill the email on the login command, below the crash info:
behorse> Login(Match(Index("users_by_email), "[email protected] TypeError: Cannot read property 'length' of undefined
at runQueries (/usr/local/Cellar/fauna-shell/0.11.5/libexec/lib/node_modules/fauna-shell/src/lib/misc.js:384:19)
behorse> /usr/local/Cellar/fauna-shell/0.11.5/libexec/lib/node_modules/fauna-shell/src/lib/misc.js:384
if (expressions.length == 1) {
^
TypeError: Cannot read property 'length' of undefined
at runQueries (/usr/local/Cellar/fauna-shell/0.11.5/libexec/lib/node_modules/fauna-shell/src/lib/misc.js:384:19)
at /usr/local/Cellar/fauna-shell/0.11.5/libexec/lib/node_modules/fauna-shell/src/commands/shell.js:86:16
at finishExecution (repl.js:411:7)
at defaultEval (repl.js:497:7)
at bound (domain.js:426:14)
at runBound (domain.js:439:12)
at REPLServer.replEvalPromise [as eval] (/usr/local/Cellar/fauna-shell/0.11.5/libexec/lib/node_modules/fauna-shell/src/commands/shell.js:71:5)
at REPLServer.complete (repl.js:1277:10)
at REPLServer.completer (repl.js:620:14)
at showCompletionPreview (internal/repl/utils.js:191:10)
at showPreview (internal/repl/utils.js:328:5)
at REPLServer.repl._refreshLine (internal/repl/utils.js:419:5)
at REPLServer.Interface.prompt (readline.js:301:10)
at REPLServer.displayPrompt (repl.js:1036:8)
at Domain.debugDomainError (repl.js:597:12)
at Domain.emit (events.js:315:20)
at Domain.EventEmitter.emit (domain.js:482:12)
at Domain._errorHandler (domain.js:246:23)
at Object.<anonymous> (domain.js:156:29)
at process._fatalException (internal/process/execution.js:164:29)
Versino: fauna-shell/0.11.5 darwin-x64 node-v12.17.0
Let me know if you need further info.
This is a test for the jira integration.
Hello! I'm having trouble doing an eval
on a child DB:
yarn fauna eval childDB "Paginate(Collections())"
› Error: Unexpected argument: Paginate(Collections())
This is the command from the doc. Eval works fine without the child db arg. Any ideas?
Relates to Homebrew/homebrew-core#41662
Console log:
==> /usr/local/Cellar/fauna-shell/0.9.3/bin/fauna add-endpoint https://endpoint1:8443
Endpoint Key:
Endpoint Alias [endpoint1]: Error: Cannot read property 'headers' of undefined
==> /usr/local/Cellar/fauna-shell/0.9.3/bin/fauna list-endpoints
Error: No endpoints defined.
See fauna add-endpoint --help for more details.
Need some help on how to use fauna add-endpoint
.
Installed ok with node v14.13.1, and cloud-login works fine, but:
fauna list-databases
Error: TypeError: config.hasOwnProperty is not a function
CreateCollection({ name: "posts" })
{ ref: Collection("posts"),
ts: 1532624109799742,
history_days: 30,
name: 'posts' }
From request-promise
github: https://github.com/request/request-promise/blob/4bc186dec9e32bdfe0c4944e50f7ad3e65bb7037/README.md
Deprecated!
As of Feb 11th 2020, request is fully deprecated. No new changes are expected to land. In fact, none have landed for some time. This package is also deprecated because it depends on request.
My recommendation would be either:
node-fetch
: https://www.npmjs.com/package/node-fetch, but I can see that node-fetch
was used before July.got
: https://www.npmjs.com/package/gotThe way errors are handled by this tool make it near impossible to build other tools or scripts on top of it in a reliable manner.
As soon as an error is thrown, the script calling fauna
is broken.
Here is an example of intended behaviour, but that fails as soon as an error is thrown.
1- Copy the code below into /tmp/role.fql:
CreateRole({ name: "user",
membership: [{ resource: Collection('User') }],
privileges: [
{
resource: Function('logout'),
actions: { call: true }
}
]
})
2- Run the code below (or any code that would trigger a remote error within fauna
):
npx fauna eval --format=json --file=/tmp/role.fql && echo '\nSuccess! No error code!'
{
errors: [
...
...
]
}
Success! No error code!
exitCode
should clearly never be 0
when the output is an error (which would then not let Success! No error code!
be shown).stderr
but instead goes in stdout
.This is a test for the Jira integration.
Is there any reason why prettier
, eslint-plugin-prettier
and eslint-config-prettier
are listed as normal dependencies? eslint
itself is a devDependency.
Running fauna list-keys
crashes with:
Error: Cannot read property 'id' of undefined
Fauna shell version:
fauna-shell/0.11.5 darwin-x64 node-v12.16.2
I have created a collection to store all my data (88k rows), which has MANY duplicate entries. I originally imported them all, but want to ensure that only unique rows are stored so I used an Index to create a Unique field and started with a fresh collection again, but when I import, I get the following expected error:
Warning: item numbers: 54819,54820,54821,54822 (zero-indexed) in your input file './imports/streamers.csv' failed to persist in Fauna due to: 'document is not unique.' - Continuing ...
Then this is the end result:
62158 rows/object failed to import. 26787 rows/object succeeded.
This is understandable as I would expect it to skip over any duplicates, but the rows succeeded seems awfully low. When I then query the Index after import, the document doesn't exist. I've done about 10 different searches at random, and only 2 results came back.
I reran the import with --append
, and got 88742 rows/object failed to import. 203 rows/object succeeded, so it seems to be an issue with duplicate rows in the same batch?
Ubuntu LTS 18.04
After update from fauna-shell 0.12.4 to 0.12.5, fauna cloud-login returns
SyntaxError: Unexpected token < in JSON at position 1
Rollback to 0.12.4 -> works ok.
fauna --version
fauna-shell/0.12.5 linux-x64 node-v14.17.6
fauna cloud-login
? The endpoint alias prefix (to combine with a region): cloud
? The endpoint alias already exists. Overwrite? Yes
? How do you prefer to authenticate? Email and Password
? Email address: [redacted]
? Password: [hidden]
SyntaxError: Unexpected token < in JSON at position 1
when i tried to login using github fauna cloud-login --github
, callback url https://auth.console.fauna.com/oauth/callback returning 500
Error handling for the shell
and eval
commands assumes that the error contains a requestResult
field. This field is only present in the FaunaHTTPError
sub class. If the error is not a FaunaHTTPError
, then the console output is
Cannot read properties of undefined (reading 'responseRaw')
triggered here:
fauna-shell/src/commands/eval.js
Line 63 in 956f7e0
and here:
fauna-shell/src/commands/shell.js
Line 109 in 956f7e0
An example is in the event the client handles a timeout (rather than receiving a 503 http response). In that case, the js driver returns a TimeoutError.
The runQueries
function always throws a QueryError
object, so checking if error
is a FaunaHTTPError
will always return false here
fauna-shell/src/commands/shell.js
Line 115 in 7b8b185
though error.faunaError
could be.
In addition to the value, the response should also return its name (so it will be possible to cache it for delete command)
Also won't be needed to make yet another request to list-keys (which are broken btw: #68)
$ fauna list-keys
listing keys
Error: Cannot read property 'id' of undefined
I'm trying to use fauna-shell to upload schema.graphql:
fauna upload-graphql-schema fauna/schema.graphql --domain db.us.fauna.com --secret SECRET_HERE --mode override
But I keep getting:
UPLOADING SCHEMA (mode=override): fauna/schema.graphql
TypeError: Only HTTP(S) protocols are supported
I finally got it to work by running:
fauna upload-graphql-schema fauna/schema.graphql \
--domain db.us.fauna.com \
--secret asdasd \
--mode override \
--graphqlHost graphql.us.fauna.com \
--scheme https \
--graphqlPort 443
notice how I had to provide all options which were supposed to be optional -- which I think is a bug.
PS: DON'T USE --method override
!! IT WILL CLEAR ALL RECORDS IN ALL YOUR COLLECTIONS, IT'S ESSENTIALLY THE SAME AS STARTING FROM SCRATCH.
FULL STORY HERE: https://forums.fauna.com/t/using-fauna-shell-to-upload-graphql-schema-for-ci-cd/2826
With 1.1.2 I could select either credentials or secret authentication upon 1st cloud-login
invocation, now 1.2.0 allows only credentials authentication. The issue is, I'm logging in to dashboard with Github auth and I don't have password.
I'd like to use fauna eval
to reset my dev database by issuing some CreateCollection
commands, but it doesn't seem to work, hmm.
Command: fauna eval db --file schema.fql --endpoint=localhost
Output: Error: Line 2: Unexpected identifier
schema.fql contains:
CreateCollection({ name: "patterns" })
CreateCollection({ name: "users" })
Hi, thanks for making fauna-shell
for us.
A batch delete doesn't seem to be in fauna-shell
and is not available in the web dashboard either, so I'm finding myself writing UI that fetches the data and iterates over all items in a collection should I want to clean it.
If there was a delete that could accept a wildcard in development mode that'd be awesome, or a way to drop entire collection.
Cheers!
The link at https://github.com/fauna/fauna-shell/blob/master/README.md#usage does not work.
This is the link: https://docs.fauna.com/fauna/current/start/cloud-github.html
running fauna upload-graphql-schema
prints "RESPONSE: undefined" in the console. The schema is successfully uploaded, but this console output is very confusing. I'm not sure what should be returned instead.
> fauna --version
fauna-shell/0.12.6 darwin-x64 node-v16.11.1
log in to a database. I used a secret key, rather than email+password.
> fauna cloud-login
once logged in, run the command
> fauna upload-graphql-schema ./schema.gql
UPLOADING SCHEMA (mode=merge): ./schema.gql
RESPONSE:
undefined
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.