Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaunaDB Adapter Setup -- Fauna Shell Commands Fail #3858

Closed
zpg6 opened this issue Feb 6, 2022 · 5 comments · Fixed by #3877
Closed

FaunaDB Adapter Setup -- Fauna Shell Commands Fail #3858

zpg6 opened this issue Feb 6, 2022 · 5 comments · Fixed by #3877
Labels
adapters Changes related to the core code concerning database adapters docs Relates to documentation fauna @auth/fauna-adapter

Comments

@zpg6
Copy link
Contributor

zpg6 commented Feb 6, 2022

Title

Fauna Adapter Setup -- Fauna Shell Commands Fail

How to reproduce ☕️

When using documentation-provided Fauna shell commands, the collections are created but not the indexes. You receive this error.

Error: [
  {
    "position": [],
    "code": "validation failed",
    "description": "document data is not valid.",
    "failures": [
      {
        "field": [
          "source"
        ],
        "code": "invalid reference",
        "description": "Cannot read reference."
      }
    ]
  }
]

Your question/bug report 📓

The solution is to separately run the CreateCollection calls altogether, then run the CreateIndex calls altogether.

In other words, just a documentation change from one block to two blocks of commands to run. Maybe a sentence clarifying that they are to be run separately.

Contributing 🙌🏽

Yes, I am

@zpg6
Copy link
Contributor Author

zpg6 commented Feb 6, 2022

As reproduced on FaunaDB console:

image

@zpg6
Copy link
Contributor Author

zpg6 commented Feb 6, 2022

If someone can confirm the error + solution proposed, I'm more than happy to submit a PR. If/once maintainers are done with their monorepo migration that is.

@balazsorban44 balazsorban44 added adapters Changes related to the core code concerning database adapters docs Relates to documentation fauna @auth/fauna-adapter labels Feb 6, 2022
@edizyurdakul
Copy link

Hi! I had the same issue I think we need to separate creating indexes and creating collections, and it worked for me so first create the collections

CreateCollection({ name: "accounts" }) CreateCollection({ name: "sessions" }) CreateCollection({ name: "users" }) CreateCollection({ name: "verification_tokens" })

after running this in the shell continue with:

CreateIndex({ name: "account_by_provider_and_provider_account_id", source: Collection("accounts"), unique: true, terms: [ { field: ["data", "provider"] }, { field: ["data", "providerAccountId"] }, ], }) CreateIndex({ name: "session_by_session_token", source: Collection("sessions"), unique: true, terms: [{ field: ["data", "sessionToken"] }], }) CreateIndex({ name: "user_by_email", source: Collection("users"), unique: true, terms: [{ field: ["data", "email"] }], }) CreateIndex({ name: "verification_token_by_identifier_and_token", source: Collection("verification_tokens"), unique: true, terms: [{ field: ["data", "identifier"] }, { field: ["data", "token"] }], })

Hope it works for you!

@zpg6
Copy link
Contributor Author

zpg6 commented Feb 7, 2022

@edizyurdakul Thanks for confirmation to proposed solution. @balazsorban44 is monorepo ready for documentation PRs? I can submit

@balazsorban44
Copy link
Member

Yep, docs should be alright! 🙏

Still thinking through the automation of versioning/publishing of packages, but that does not affect the docs site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adapters Changes related to the core code concerning database adapters docs Relates to documentation fauna @auth/fauna-adapter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants