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

Unexpected end of JSON input #83

Open
Fenn-CS opened this issue Feb 23, 2023 · 4 comments
Open

Unexpected end of JSON input #83

Fenn-CS opened this issue Feb 23, 2023 · 4 comments

Comments

@Fenn-CS
Copy link
Contributor

Fenn-CS commented Feb 23, 2023

Sometimes the Permanent SDK (backend) returns nothing when the getFolder endpoint is hit. This can be for various reasons such as 401's or 500's.

We need to ultimately open follow up issues in the back-end repository.

@Fenn-CS
Copy link
Contributor Author

Fenn-CS commented Feb 23, 2023

Several "unexpected end of JSON input" errors reported.... (On VIP archive test)

SFTP Service side

2/21/2023, 9:56:51 PM warn: Failed to load file {"reqId":6875,"filename":"/archives/path/redacted"}
2/21/2023, 9:56:51 PM warn: Unexpected end of JSON input
SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at typedJsonParse (/home/fenn-cs/permanent/sftp-service/node_modules/@permanentorg/sdk/dist/cjs/utils/typedJsonParse.js:6:24)
    at getFolderVo (/home/fenn-cs/permanent/sftp-service/node_modules/@permanentorg/sdk/dist/cjs/api/getFolderVo.js:14:39)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at getFolder (/home/fenn-cs/permanent/sftp-service/node_modules/@permanentorg/sdk/dist/cjs/sdk/getFolder.js:6:101)
    at PermanentFileSystem.loadFolder (/home/fenn-cs/permanent/sftp-service/src/classes/PermanentFileSystem.ts:286:35)
    at PermanentFileSystem.loadArchiveRecord (/home/fenn-cs/permanent/sftp-service/src/classes/PermanentFileSystem.ts:184:26)
    at PermanentFileSystem.loadFile (/home/fenn-cs/permanent/sftp-service/src/classes/PermanentFileSystem.ts:173:27)

rclone SIDE

2023-02-21 21:56:49 ERROR : archives/path/redacted: Failed to copy: failed to open source object: Open failed: sftp: "" (SSH_FX_FAILURE)

@Fenn-CS
Copy link
Contributor Author

Fenn-CS commented Mar 1, 2023

Further local debugging did reveal that the "unexpected JSON" which eventually gets passed to JSON.parse is actually an empty string.

No the back-end and consequently permanent-sdk returns nothing, potentially due do some kind of 501.

@Fenn-CS
Copy link
Contributor Author

Fenn-CS commented Mar 13, 2023

Over the weekend I carried out some debug steps and it looks like the problem is not from the back-end or if it is, it is probably associated with the version implementation of api/folder/getWithChildren

  1. Queried affected files and folders from UI and there were no apparent error codes (Everything was 200)
  2. Did direct API hit to https://www.permanent.org/api/folder/getWithChildren?folderId=XXX&archiveId=XXX and obtained 200 as well. (My request was authenticated via the browser session and so I would want to try with the bearer token but don't have enough access on FushionAuth for prod, so I would like to connect with @slifty to do this last try)

Should trying with the bearerToken also return a 200 we would need to look at the sftp-service more closely.

@Fenn-CS
Copy link
Contributor Author

Fenn-CS commented Apr 20, 2023

After more digging, @slifty and I have concluded this issue is related to data configuration on prod. Which means the only way to reproduce it, is to have a snapshot of that unique database rows concerned.

Leaving this open because the issue is not actually "solved" but that's the current state of investigations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant