local-first-web / auth

Decentralized authentication and authorization for team collaboration, using a secure chain of cryptological signatures. (Formerly known as ๐ŸŒฎ Taco.)
MIT License
260 stars 22 forks source link

Trouble running auth demo #49

Closed bigdogwillfeed closed 1 year ago

bigdogwillfeed commented 2 years ago

Today I tried running the demo and was unable to get anything working. I figured out I needed to install yarn and then install the dependencies, but was unable to proceed much further. I'm not particularly fluent in yarn (used to npm), so apologies if this is a case of me simply holding it wrong.

Here's the output from my machine:

nathan@Nathans-MacBook-Pro auth % node -v
v16.16.0
nathan@Nathans-MacBook-Pro auth % git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean
nathan@Nathans-MacBook-Pro auth % git log -n 1
commit 49907d409d39a7b9c24f23f82fed1c3541ee05ed (HEAD -> main, origin/main, origin/HEAD)
Author: HerbCaudill <herb@devresults.com>
Date:   Fri Sep 16 15:16:22 2022 +0200

    update for latest crdx with encrypted chain
nathan@Nathans-MacBook-Pro auth % yarn install
yarn install v1.22.19
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
warning "lerna > @lerna/version > @lerna/github-client > @octokit/rest > @octokit/plugin-request-log@1.0.4" has unmet peer dependency "@octokit/core@>=3".
warning "workspace-aggregator-ab7c30cb-ba03-43b5-82a1-2042247dd175 > demo > @testing-library/user-event@13.5.0" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "workspace-aggregator-ab7c30cb-ba03-43b5-82a1-2042247dd175 > demo > @windmill/react-ui > react-focus-lock@2.4.1" has incorrect peer dependency "react@^16.8.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
success Saved lockfile.
โœจ  Done in 14.43s.
nathan@Nathans-MacBook-Pro auth % yarn dev
yarn run v1.22.19
$ run-p watch dev:demo
$ lerna run watch --stream --parallel
$ yarn --cwd demo && yarn --cwd demo dev
[1/4] ๐Ÿ”  Resolving packages...
โ  lerna notice cli v3.22.1
lerna info Executing command in 1 package: "yarn run watch"
success Already up-to-date.
@localfirst/auth: $ npm-watch
$ run-p dev:relay dev:serve
@localfirst/auth: No task specified. Will go through all possible tasks
$ cross-env DEBUG='lf*' DEBUG_COLORS=1 node ./scripts/start-relay-server.js
$ vite --port 3000
@localfirst/auth: [build] [nodemon] 2.0.15
@localfirst/auth: [postbuild] [nodemon] starting `npm run -s postbuild`
@localfirst/auth: [build] [nodemon] starting `npm run -s build`
  lf:relay:8080 version 3.6.0 +0ms
๐ŸŸ โฏ Listening at http://localhost:8080
  lf:relay:8080 ready +6ms
@localfirst/auth: [postbuild] tscpaths --project /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/tsconfig.build.json --src /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/src --out /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/dist
@localfirst/auth: [postbuild] Replaced 0 paths in 0 files
@localfirst/auth: [postbuild] [nodemon] clean exit - waiting for changes before restart

  vite v2.9.0 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 1055ms.

โœ˜ [ERROR] [plugin vite:dep-scan] Failed to resolve entry for package "@localfirst/auth". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@localfirst/auth". The package may have incorrect main/module/exports specified in its package.json.

    ../node_modules/vite/dist/node/chunks/dep-8db0e223.js:38291:10:
      38291 โ”‚     throw new Error(`Failed to resolve entry for package "${id}". ` +
            โ•ต           ^

    at packageEntryFailure (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:38291:11)
    at resolvePackageEntry (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:38287:9)
    at tryNodeResolve (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:38094:20)
    at Context.resolveId (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:37902:28)
    at Object.resolveId (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:36470:55)
    at async resolve (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:36682:26)
    at async /Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:36839:34
    at async callback (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:918:28)
    at async handleRequest (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:698:30)

  This error came from the "onResolve" callback registered here:

    ../node_modules/vite/dist/node/chunks/dep-8db0e223.js:36829:18:
      36829 โ”‚             build.onResolve({
            โ•ต                   ~~~~~~~~~

    at setup (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:36829:19)
    at handlePlugins (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:840:23)
    at Object.buildOrServe (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:1134:7)
    at /Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:2076:17
    at new Promise (<anonymous>)
    at Object.build (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:2075:14)
    at Object.build (/Users/nathan/Documents/Projects/local-first-web/auth/node_modules/esbuild/lib/main.js:1924:51)
    at /Users/nathan/Documents/Projects/local-first-web/auth/node_modules/vite/dist/node/chunks/dep-8db0e223.js:36630:54
    at Array.map (<anonymous>)

  The plugin "vite:dep-scan" was triggered by this import

    src/components/App.tsx:1:22:
      1 โ”‚ import * as auth from '@localfirst/auth'

... [same error repeats many times]
^C
nathan@Nathans-MacBook-Pro auth % yarn dev:cy
yarn run v1.22.19
$ run-p watch dev:cy:demo
$ yarn --cwd demo && yarn --cwd demo dev:cy
$ lerna run watch --stream --parallel
[1/4] ๐Ÿ”  Resolving packages...
โ  lerna notice cli v3.22.1
lerna info Executing command in 1 package: "yarn run watch"
@localfirst/auth: $ npm-watch
success Already up-to-date.
@localfirst/auth: No task specified. Will go through all possible tasks
$ cross-env BROWSER=none CYPRESS_REMOTE_DEBUGGING_PORT=9222 run-p dev test:cy
@localfirst/auth: [postbuild] [nodemon] 2.0.15
@localfirst/auth: [postbuild] [nodemon] starting `npm run -s postbuild`
@localfirst/auth: [build] [nodemon] starting `npm run -s build`
$ run-p dev:relay dev:serve
$ cypress open
@localfirst/auth: [postbuild] tscpaths --project /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/tsconfig.build.json --src /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/src --out /Users/nathan/Documents/Projects/local-first-web/auth/packages/auth/dist
@localfirst/auth: [postbuild] Replaced 0 paths in 0 files
@localfirst/auth: [postbuild] [nodemon] clean exit - waiting for changes before restart
$ cross-env DEBUG='lf*' DEBUG_COLORS=1 node ./scripts/start-relay-server.js
$ vite --port 3000
  lf:relay:8080 version 3.6.0 +0ms
๐ŸŸ โฏ Listening at http://localhost:8080
  lf:relay:8080 ready +6ms

  vite v2.9.0 dev server running at:

  > Local: http://localhost:3000/
  > Network: use `--host` to expose

  ready in 1021ms.

@localfirst/auth: [build] src/connection/Connection.ts(125,27): error TS2339: Property 'userId' does not exist on type 'UserWithSecrets'.
@localfirst/auth: [build] src/connection/Connection.ts(194,40): error TS2322: Type 'SyncMessage<Action, unknown>' is not assignable to type 'SyncMessage<TeamAction, TeamContext>'.
@localfirst/auth:   Type 'Action' is not assignable to type 'TeamAction'.
@localfirst/auth:     Type '{ type: string; payload: any; }' is not assignable to type 'TeamAction'.
@localfirst/auth:       Type '{ type: string; payload: any; }' is not assignable to type 'RotateKeysAction'.
@localfirst/auth:         Types of property 'type' are incompatible.
@localfirst/auth:           Type 'string' is not assignable to type '"ROTATE_KEYS"'.
@localfirst/auth: [build] src/connection/Connection.ts(499,9): error TS2554: Expected 3 arguments, but got 4.
@localfirst/auth: [build] src/team/bySeniority.ts(12,44): error TS2769: No overload matches this call.
@localfirst/auth:   Overload 1 of 2, '(predicate: (this: void, value: unknown, index: number, obj: unknown[]) => value is unknown, thisArg?: any): unknown', gave the following error.
@localfirst/auth:     Argument of type '(link: TeamLink) => boolean' is not assignable to parameter of type '(this: void, value: unknown, index: number, obj: unknown[]) => value is unknown'.
@localfirst/auth:       Types of parameters 'link' and 'value' are incompatible.
@localfirst/auth:         Type 'unknown' is not assignable to type 'TeamLink'.
@localfirst/auth:           Type '{}' is missing the following properties from type 'Link<TeamAction, TeamContext>': hash, body, signed
@localfirst/auth:   Overload 2 of 2, '(predicate: (value: unknown, index: number, obj: unknown[]) => unknown, thisArg?: any): unknown', gave the following error.
@localfirst/auth:     Argument of type '(link: TeamLink) => boolean' is not assignable to parameter of type '(value: unknown, index: number, obj: unknown[]) => unknown'.
@localfirst/auth:       Types of parameters 'link' and 'value' are incompatible.
@localfirst/auth:         Type 'unknown' is not assignable to type 'TeamLink'.
@localfirst/auth:           Type 'unknown' is not assignable to type 'Link<TeamAction, TeamContext>'.
@localfirst/auth: [build] src/team/bySeniority.ts(17,28): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'Link<Action, unknown>'.
@localfirst/auth:   Type '{}' is missing the following properties from type 'Link<Action, unknown>': hash, body, signed
@localfirst/auth: src/team/getMissingLinks.ts(1,18): error TS2305: Module '"crdx"' has no exported member 'HashGraph'.
@localfirst/auth: src/team/getMissingLinks.ts(5,27): error TS2339: Property 'body' does not exist on type 'unknown'.
@localfirst/auth: [build] src/team/membershipResolver.ts(144,57): error TS2551: Property 'userId' does not exist on type 'LinkBody<TeamAction, TeamContext>'. Did you mean 'user'?
@localfirst/auth:   Property 'userId' does not exist on type '{ user: User; timestamp: number; prev: string[]; } & RootAction & TeamContext'.
@localfirst/auth: [build] src/team/redactUser.ts(5,3): error TS2741: Property 'userId' is missing in type '{ roles: undefined[]; userName: string; keys: Keyset; }' but required in type 'Member'.
@localfirst/auth: [build] src/team/Team.ts(108,9): error TS2345: Argument of type '{ user: UserWithSecrets; reducer: Reducer<TeamState, TeamAction, TeamContext>; resolver: Resolver<TeamAction, TeamContext>; initialState: TeamState; rootPayload: { ...; }; graphKeys: KeysetWithSecrets; }' is not assignable to parameter of type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth:   Object literal may only specify known properties, and 'graphKeys' does not exist in type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth: src/team/Team.ts(121,9): error TS2345: Argument of type '{ user: UserWithSecrets; reducer: Reducer<TeamState, TeamAction, TeamContext>; resolver: Resolver<TeamAction, TeamContext>; initialState: TeamState; graph: any; graphKeys: KeysetWithSecrets; }' is not assignable to parameter of type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth:   Object literal may only specify known properties, and 'graph' does not exist in type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth: [build] src/team/Team.ts(152,23): error TS2339: Property 'getGraph' does not exist on type 'Store<TeamState, TeamAction, {}>'.
@localfirst/auth: src/team/Team.ts(625,7): error TS2345: Argument of type '{ user: UserWithSecrets; reducer: Reducer<TeamState, TeamAction, TeamContext>; resolver: Resolver<TeamAction, TeamContext>; initialState: TeamState; graph: any; graphKeys: KeysetWithSecrets; }' is not assignable to parameter of type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth:   Object literal may only specify known properties, and 'graph' does not exist in type 'StoreOptions<TeamState, TeamAction, TeamContext>'.
@localfirst/auth: [build] src/team/Team.ts(740,53): error TS2339: Property 'userId' does not exist on type 'UserWithSecrets'.
@localfirst/auth: src/team/Team.ts(745,53): error TS2339: Property 'userId' does not exist on type 'UserWithSecrets'.
@localfirst/auth: src/team/Team.ts(800,52): error TS2554: Expected 1 arguments, but got 2.
@localfirst/auth: [build] src/team/types.ts(8,3): error TS2305: Module '"crdx"' has no exported member 'HashGraph'.
@localfirst/auth: src/team/validate.ts(30,19): error TS2339: Property 'userId' does not exist on type 'LinkBody<TeamAction, TeamContext>'.
@localfirst/auth: [build] src/team/validate.ts(65,32): error TS2551: Property 'userId' does not exist on type '{ user: User; timestamp: number; prev: string[]; } & ChangeMemberKeysAction & TeamContext'. Did you mean 'user'?
@localfirst/auth: src/util/testing/Network.ts(103,7): error TS2554: Expected 3 arguments, but got 4.
@localfirst/auth: [build] src/util/testing/setup.ts(42,41): error TS2554: Expected 1-2 arguments, but got 3.
@localfirst/auth: [build] [nodemon] app crashed - waiting for file changes before starting...
bigdogwillfeed commented 2 years ago

I was able to run the demo at an arbitrary earlier commit, and I bisected to find baa8fb4c475243e61e0650ca017da85cdcdabc69 as the most recent functional commit

HerbCaudill commented 1 year ago

Thanks โ€” the demo is working on main now.