fraction / oasis

Free, open-source, peer-to-peer social application that helps you follow friends and discover new ones on Secure Scuttlebutt (SSB).
http://oasis-demo.fraction.io
GNU Affero General Public License v3.0
284 stars 42 forks source link

ssb.friends.get Error #718

Closed analoglesbian closed 2 years ago

analoglesbian commented 3 years ago

I just installed Oasis, since Patchwork is being sunsetted, and when I first launched it said it was processing my database, but once that finished, it gave me the following error message:

TypeError: ssb.friends.get is not a function
at socialFilter (/usr/local/lib/node_modules/@fraction/oasis/src/models.js:669:50)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async getMessages (/usr/local/lib/node_modules/@fraction/oasis/src/models.js:630:31)
at async Object.mentionsMe (/usr/local/lib/node_modules/@fraction/oasis/src/models.js:957:24)
at async mentions (/usr/local/lib/node_modules/@fraction/oasis/src/index.js:784:24)
at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:788:16
at async middleware (/usr/local/lib/node_modules/@fraction/oasis/src/index.js:1085:7)
at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:1063:5
at async /usr/local/lib/node_modules/@fraction/oasis/src/index.js:1058:5
at async /usr/local/lib/node_modules/@fraction/oasis/src/http.js:113:5

I've tried installing both the stable and unstable versions, and get this same error either way. Do I need to do anything special to import my Patchwork ssb database?

mitra42 commented 3 years ago

I'm seeing the exact same problem (and for the same reason)

analoglesbian commented 3 years ago

I forgot to include that this was with Node v14.17.1 on MacOS v11.2.3.

I tried reinstalling Node completely, rolling it back to v12, and neither could get the instructions from the README to result in a working install.

However, I was able to get Oasis running by using npm build and npm start on the source tree for v2.17.0. I would not count this as a solution though, because the listed instructions still do not work, even after I was able to get a successful install by building from source.

mitra42 commented 3 years ago

Mine was Node v14.7.1 on MacOS v11.4 - i just saw there were a lot of errors in the oasis console - looks easy to replicate.

lordcirth commented 3 years ago

Ran into this issue today as well.

mitra42 commented 3 years ago

Did any of you find a way around this ?

mitra42 commented 2 years ago

ugg - Anyone got suggestions for an alternative to Oasis that works with old patchwork database :-( (on current Node and OSX?)

retog commented 2 years ago

I'm getting the same error in a fresh node:12-buster docker container, so this seems unrelated to the old database format.

pospi commented 2 years ago

Also getting it here with Node 15.5.0, Ubuntu 20.04.2.

Unlike @analoglesbian I was not able to run the app from source (latest @ time of writing eabc34e, but the same as the last tagged release aside from package maintenance updates).

Looking at it now, node is still maxing out 4 CPUs with the erroring page in question open. It may just be that there is more data for Oasis yet to process. This would seem to be confirmed by a second error message being printed some time later (several minutes)-

  message: 'method:ebt,replicate is not in list of allowed methods',
  name: 'Error',
  stack: 'Error: method:ebt,replicate is not in list of allowed methods\n' +
    '    at Function.perms.pre (/app/node_modules/muxrpc/permissions.js:88:14)\n' +

I occasionally get ECONNRESET errors as well. Hard to know what the issue is, but certainly I have yet to see a working UI. Will leave it open for a few hours and loop back here if that changes.

mitra42 commented 2 years ago

Did you figure this out @pospi ?

pospi commented 2 years ago

Yeah. The amusing workaround is to just run Patchwork in another window first, then run Oasis, then open your browser. It needs to piggyback off the Patchwork backend server 'cos its one appears to have problems.

On Tue, 17 Aug 2021 at 10:44, Mitra Ardron @.***> wrote:

Did you figure this out @pospi https://github.com/pospi ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fraction/oasis/issues/718#issuecomment-899910115, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADK2JEEOZQF6YLXBHP2EGDT5GWG3ANCNFSM47RPKR7Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

-- writings http://pospi.spadgos.com/ | twitter https://twitter.com/pospigos | github https://github.com/pospi ← where to find me ValueFlows https://www.valueflo.ws/ | Holo-REA https://github.com/holo-rea/ ← things I'm working on

mitra42 commented 2 years ago

That's hilarious @pospi - especially since the whole point is to get off of Patchwork because (according to the patchwork repo) its got problems and shouldn't be used. From the silence in this repo, I'm guessing Oasis's server isn't under active dev either, any suggestions for an alternative.

almereyda commented 2 years ago

I'm running into the same issue by following the instructions for building Oasis with Docker.

nickwynja commented 2 years ago

This is caused by #715. In ssb-friends@5.0.0, the legacy APIs were removed. npm install ssb-friends@4.4.7 gets Oasis working again.

mhfowler commented 2 years ago

@nickwynja after running npm install ssb-friends@4.4.7, the next error I get is:

TypeError: Cannot read properties of undefined (reading 'getFileName')
    at module.exports (/srv/tools/oasis/node_modules/caller-path/index.js:4:40)
    at requireStyle (/srv/tools/oasis/node_modules/require-style/index.js:17:22)
    at /srv/tools/oasis/src/index.js:575:16
    at dispatch (/srv/tools/oasis/node_modules/koa-compose/index.js:42:32)
    at /srv/tools/oasis/node_modules/@koa/router/lib/router.js:372:16
    at dispatch (/srv/tools/oasis/node_modules/koa-compose/index.js:42:32)
    at /srv/tools/oasis/node_modules/koa-compose/index.js:34:12
    at dispatch (/srv/tools/oasis/node_modules/@koa/router/lib/router.js:377:31)
    at dispatch (/srv/tools/oasis/node_modules/koa-compose/index.js:42:32)
    at middleware (/srv/tools/oasis/src/index.js:1085:13)
nickwynja commented 2 years ago

@mhfowler Seems like the same issue as #688. Are you also on node 16?

mhfowler commented 2 years ago

@nickwynja thanks. I was on node 16, and I just now tried switching to 14 and now its working :cactus:

nickwynja commented 2 years ago

Even with this ssb.friends.get error resolved, Oasis seems to have trouble fetching/syncing/replicating new messages. Looking into that too since I think it's another updated or out-of-date dependency issue.

mitra42 commented 2 years ago

Any luck @nickwynja ?

nickwynja commented 2 years ago

@mitra42 I wasn't able to solve the dependency issues but locally reverted back to the last commit hash that wasn't a dependabot automated merge. That was https://github.com/fraction/oasis/commit/4e8f7426a4eb1d95f6e55cf894a3168f523f8af8. You can check out this version doing git checkout 4e8f7426a4eb1d95f6e55cf894a3168f523f8af8. Then I did a fresh install of node modules by doing rm -rf node_modules and then npm install. This got me a working version.

mitra42 commented 2 years ago

Thanks Nick - I'll give that a go.

I don't what the dev culture in this group is, but I'd have thought that maybe the package owner should revert out those dependabot merges for the "stable" version until someone has time to figure out the issues - I had to do that for one of the packages I'm admin for.

mitra42 commented 2 years ago

That worked, and it looks like it picked up my id and follows etc from the old Patchwork DB I copied over. Looks like the full path to install and run is ...

git clone https://github.com/fraction/oasis.git
cd oasis
git checkout 4e8f7426a4eb1d95f6e55cf894a3168f523f8af8
oasis/src/index.js

Would you agree - and if so I wonder if I should do a Pull request on the README as, currently the install instructions (from npm) are incorrect for Mac users, and judging by the age of this bug it doesn't look like there is anyone with the skills and time to fix it?

retog commented 2 years ago

@christianbundy, can the breaking change be reverted?

christianbundy commented 2 years ago

👍 I'd imagine either I or @nickwynja would merge a PR to revert this change.

rhz commented 2 years ago

I can confirm that this error isn't related to patchwork. I was using oasis about a year ago and it was working without issues. I haven't used patchwork since then, yet I get this same error on most pages when running oasis now. I'm on node version 16.11.1. By downgrading to 14.17.4 I solve issue #688. By then doing

git pull
git checkout 4e8f7426a4eb1d95f6e55cf894a3168f523f8af8
rm -rf node_modules
npm install --only=prod
npm -g install .
systemctl --user restart oasis

on a local git clone I can re-install oasis globally and re-start the oasis server. As others said before, this new build doesn't give the ssb.friends.get error.

nsantini commented 2 years ago

I got a solution in the code for using ssb-friends 5.0.0 (the one currently installed in the master branch)

diff --git a/src/models.js b/src/models.js
index 2e5dbac..6439f32 100644
--- a/src/models.js
+++ b/src/models.js
@@ -666,16 +666,22 @@ module.exports = ({ cooler, isPublic }) => {
   } = {}) => {
     const ssb = await cooler.open();
     const { id } = ssb;
-    const relationshipObject = await ssb.friends.get({
-      source: id,
-    });
+    const relationshipObject = await (new Promise((resolve, reject) => {
+      ssb.friends.graph((err, graph) => {
+        if (err) {
+          console.error(err)
+          reject(err)
+        }
+        resolve(graph[id] || {})
+      })
+    }))

     const followingList = Object.entries(relationshipObject)
-      .filter(([, val]) => val === true)
+      .filter(([, val]) => val >= 0)
       .map(([key]) => key);

     const blockingList = Object.entries(relationshipObject)
-      .filter(([, val]) => val === false)
+      .filter(([, val]) => val === -1)
       .map(([key]) => key);

     return pull.filter((message) => {

I'll try to open a PR with it

nickwynja commented 2 years ago

Would anyone following this thread be able to try running @nsantini's PR #784 to see if it works for you and continues to pull/stream/update posts? I'm not receiving any errors but also no new posts are syncing when running this branch so want to see if anyone else is seeing that same behavior.

nickwynja commented 2 years ago

This is now fixed in the master branch.