pondersource / sciencemesh-php

Connect your Nextcloud server to Sciencemesh
MIT License
0 stars 1 forks source link

Network Beta debugging #164

Open michielbdejong opened 1 year ago

michielbdejong commented 1 year ago

Testing with the pondersource/sciencemesh branch instead of the michielbdejong/mentix-fixes branch

michielbdejong commented 1 year ago

The POST to /ocm/invites/generate became a GET to /sciencemesh/generate-invite

michielbdejong commented 1 year ago

See also https://github.com/cs3org/ocm-test-suite/pull/72

michielbdejong commented 1 year ago

Testing session planned for tomorrow 28 Feb. I'll try to fix https://github.com/pondersource/sciencemesh-php/issues/166 Or at least we can test everything else and do the sending from Reva CLI if that fix arrives late.

michielbdejong commented 1 year ago

I was able to use reva CLI on mesh.pondersource.com to exchange invites (both sending and receiving) with CERN OCIS.

But when I try to list the contacts on cloud.pondersource.com I run into this error in the reva logs:

2023-02-28 16:08:36.023 ERR ../reva/internal/grpc/services/storageprovider/storageprovider.go:950 > error listing container: path:"/home"  error="json: cannot unmarshal number -1 into Go struct field ResourceInfo.size of type uint64" pid=1164779 pkg=rgrpc traceid=66327328ebf30a576408dfbeb3b63df2
2023-02-28 16:08:36.308 INF ../reva/pkg/storage/fs/nextcloud/nextcloud.go:272 > CreateDir {"path":"/home/asdf"} pid=1164779 pkg=rgrpc traceid=a4ece9fa449b7676ef9622d1fc73eb6a
2023-02-28 16:08:36.309 INF ../reva/pkg/storage/fs/nextcloud/nextcloud.go:221 > nc.do req https://cloud.pondersource.org/index.php/apps/sciencemesh/~einstein/api/storage/CreateDir {"path":"/home/asdf"} pid=1164779 pkg=rgrpc traceid=a4ece9fa449b7676ef9622d1fc73eb6a
2023-02-28 16:08:37.46 INF ../reva/pkg/storage/fs/nextcloud/nextcloud.go:240 > nc.do res https://cloud.pondersource.org/index.php/apps/sciencemesh/~einstein/api/storage/CreateDir {"error":"Could not create directory."} pid=1164779 pkg=rgrpc traceid=a4ece9fa449b7676ef9622d1fc73eb6a
2023-02-28 16:08:37.46 ERR ../reva/internal/grpc/services/storageprovider/storageprovider.go:666 > error creating container: path:"/home/asdf"  error="Unexpected response code from EFSS API: 500:{\"error\":\"Could not create directory.\"}" pid=1164779 pkg=rgrpc traceid=a4ece9fa449b7676ef9622d1fc73eb6a
2023-02-28 16:09:57.088 WRN ../reva/internal/http/interceptors/auth/auth.go:218 > core access token not set pid=1164779 pkg=rhttp traceid=5593440fcd31e5de41b52aacb63f0123
2023-02-28 16:09:57.089 WRN ../reva/internal/http/interceptors/log/log.go:108 > http end="28/Feb/2023:16:09:57 +0000" host=172.105.82.111 method=GET pid=1164779 pkg=rhttp proto=HTTP/1.1 size=0 start="28/Feb/2023:16:09:57 +0000" status=401 time_ns=883699 traceid=5593440fcd31e5de41b52aacb63f0123 uri=/ url=/
michielbdejong commented 1 year ago

Ah wait, I was checking the wrong server :)

michielbdejong commented 1 year ago

Cannot receive shares on cloud.pondersource.com, getting this exception:

{"reqId":"L7ldo9VqcBrqPTYGXIT5","level":3,"time":"2023-03-02T08:07:55+00:00","remoteAddr":"138.68.152.232","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/sciencemesh\/~einstein\/api\/ocm\/addReceivedShare","message":"Caused by: {\"Exception\":\"PDOException\",\"Message\":\"SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'remote' cannot be null\",
michielbdejong commented 1 year ago

Next error:

{\n  "code": "INVALID_PARAMETER",\n  "message": "invalid parameters"\n}' info: array (\n  'url' => 'https://mesh.pondersource.com/sciencemesh/create-share',\n  'content_type' => 'application/json',\n  'http_code' => 400,\n  'header_size' => 735,\n  'request_size' => 215,\n  'filetime' => -1,\n  'ssl_verify_result' => 0,\n  'redirect_count' => 0,\n  'total_time' => 0.18298,\n  'namelookup_time' => 0.002284,\n  'connect_time' => 0.002948,\n  'pretransfer_time' => 0.018608,\n  'size_upload' => 298.0,\n  'size_download' => 68.0,\n  'speed_download' => 373.0,\n  'speed_upload' => 1637.0,\n  'download_content_length' => 68.0,\n  'upload_content_length' => 298.0,\n  'starttransfer_time' => 0.018656,\n  'redirect_time' => 0.0,\n  'redirect_url' => '',\n  'primary_ip' => '138.68.152.232',\n  'certinfo' => \n  array (\n  ),\n  'primary_port' => 443,\n  'local_ip' => '172.21.0.3',\n  'local_port' => 38956,\n  'http_version' => 3,\n  'protocol' => 2,\n  'ssl_verifyresult' => 0,\n  'scheme' => 'HTTPS',\n  'appconnect_time_us' => 18481,\n  'connect_time_us' => 2948,\n  'namelookup_time_us' => 2284,\n  'pretransfer_time_us' => 18608,\n  'redirect_time_us' => 0,\n  'starttransfer_time_us' => 18656,\n  'total_time_us' => 182980,\n)
michielbdejong commented 1 year ago

Key: 'createShareRequest.Role' Error:Field validation for 'Role' failed on the 'oneof' tag"

michielbdejong commented 1 year ago

Next error:

"error: bad request: invalid reference resource_id:<storage_id:\"00000000-0000-0000-0000-0000000000
00\" opaque_id:\"fileid-/home/forgiuseppe\" > 
michielbdejong commented 1 year ago

Fixed by correcting this line in the live server config

michielbdejong commented 1 year ago

Next error:

{"reqId":"XmBeBG4yZ7uJSODoQm1h","level":3,"time":"2023-03-02T09:06:44+00:00","remoteAddr":"138.68.152.232","user":"--","app":"index","method":"POST","url":"\/index.php\/apps\/sciencemesh\/~einstein\/api\/ocm\/addSentShare","message":"Exception: {\"Exception\":\"TypeError\",\"Message\":\"
Argument 1 passed to 
OCA\\\\ScienceMesh\\\\Controller\\\\RevaController::getPermissionsCode() must be of the type array,
 null given, called in \\\/var\\\/www\\\/html\\\/apps\\\/sciencemesh\\\/lib\\\/Controller\\\/RevaController.php 
on line 875\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/html\\\/apps\\\/sciencemesh\\\/lib\\\/Controller\\\/RevaController.php(875): OCA\\\\ScienceMesh\\\\Controller\\\\RevaController->getPermissionsCode()\\n#1 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(169): OCA\\\\ScienceMesh\\\\Controller\\\\RevaController->addSentShare()\\n#2 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(89): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController()\\n#3 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/App.php(99): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch()\\n#4 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main()\\n#5 \\\/var\\\/www\\\/html\\\/lib\\\/private\\\/Route\\\/Router.php(344): OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke()\\n#6 \\\/var\\\/www\\\/html\\\/lib\\\/base.php(913): OC\\\\Route\\\\Router->match()\\n#7 \\\/var\\\/www\\\/html\\\/index.php(54): OC::handleRequest()\\n#8 {main}\",\"File\":\"\\\
michielbdejong commented 1 year ago
am.do https://cloud.pondersource.com/index.php/apps/sciencemesh/~einstein/api/ocm/addSentShare
{"resourceId":
{"storageId":"00000000-0000-0000-0000-000000000000", "opaqueId":"fileid-/home/forgiuseppe"}, 
"name":"home", "token":"yP1SsdhyqfrzlP0Iov9PDIxg5dNofCzL", 
"grantee":{"type":"GRANTEE_TYPE_USER", 
    "userId":{"idp":"sm1.cernbox.cern.ch", "opaqueId":"lopresti"}},
 "owner":{"idp":"https://mesh.pondersource.com/", "opaqueId":"einstein"}, 
"creator":{"idp":"https://mesh.pondersource.com/", "opaqueId":"einstein"}, 
"ctime":{"seconds":"1677749531", "nanos":797120103}, 
"mtime":{"seconds":"1677749531", "nanos":797120103}, 
"shareType":"SHARE_TYPE_USER", "accessMethods":[
{"webdavOptions":{"permissions":{"getPath":true, "getQuota":true, "ini
tiateFileDownload":true, "listGrants":true, "listContainer":true, "listFileVersions":true, 
"listRecycle":true, "stat":
true}}}, {"webappOptions":{"viewMode":"VIEW_MODE_READ_ONLY"}}]} 
pid=1100047 pkg=rgrpc traceid=62516820c5b510adc17608ec
06a920d6                                                                                 

After changing some field names in the parameters of addSentShare, I was as able to send a share to Guiseppe.

michielbdejong commented 1 year ago

Next problem: it shares /home instead of /home/Welcome.txt (and tries to stat /home/MyShares for some reason?)

michielbdejong commented 1 year ago

The sent share has resourceId.opaqueId "fileid-/home/asdf/qwer" but name "home"

michielbdejong commented 1 year ago

We call reva/sciencemesh/create-share with:

{
  "sourcePath":"\\/home\\/asdf\\/qwer\\/",
  "targetPath":"\\/asdf\\/qwer\\/",
  "type":"dir",
  "recipientUsername":"lopresti",
  "recipientHost":"sm2.cernbox.cern.ch",
  "loginType":"basic",
  "loginUsername":"einstein",
  "loginPassword":"fJaKtaG...",
  "role":"viewer"
}
michielbdejong commented 1 year ago

I don't understand why it's doing filepath.Base here: https://github.com/cs3org/reva/blame/master/internal/grpc/services/ocmshareprovider/ocmshareprovider.go#L242

michielbdejong commented 1 year ago

That is what causes all shares to show up as "/home", I think. @gmgigi96 can you clarify?