wallabag.el icon indicating copy to clipboard operation
wallabag.el copied to clipboard

[error] request--callback: peculiar error: 500

Open olivierclermont opened this issue 4 years ago • 5 comments

I tried several times to setup wallabag.el but I have this error. What do I do wrong ? I am not on a server of my own.

olivierclermont avatar Dec 10 '21 14:12 olivierclermont

Double check the wallabag version, maybe you need to update the server.

chenyanming avatar Dec 10 '21 17:12 chenyanming

I updated the patch, how about now?

chenyanming avatar Feb 07 '22 03:02 chenyanming

I'm getting this error too. Specifically, wallabag-request-and-insert-entries returns

{"error":{"code":500,"message":"Internal Server Error"}}

in its data payload. However, wallabag-request-token did successfully connect to the Wallabag instance and obtain an access token. I ran the same query that wallabag-request-new-entries runs but using curl + the access token and it returned entries.

My Wallabag instance is docker based, and updated to the latest version.

karthink avatar Jul 08 '22 16:07 karthink

Ok, I discovered the error. I am starting from an empty db. In the success callback for wallabag-request-new-entries,

(cl-function
 (lambda (&key data &allow-other-keys)
   (setq entries (append (wallabag-parse-json (json-read-from-string data)) nil))
   (let* ((latest-id (alist-get 'id (car entries)))
          (max-id (or (caar (wallabag-db-sql `[:select id :from items :order :by id :desc :limit 1])) 0))
          (number-of-retrieved (- latest-id max-id)))
     (cond
       ((= number-of-retrieved 0)
        (message "No New Entries")
        (setq wallabag-retrieving-p nil))
       ((< number-of-retrieved 0) ;; the actual number may be less than (abs number-of-retrieved)
        (wallabag-request-and-delete-entries (abs number-of-retrieved)))
       (t
        ;; (message "Found there may have %s new articles." number-of-retrieved)
        (wallabag-request-and-insert-entries number-of-retrieved))))))
                      

my max-id is 0 since the db is empty, and latest-id is 9530 (I have a 10+ year collection of articles on Wallabag.)

This asks wallabag-request-and-delete-entries to retrieve 9530 entries, which is too many for the server to return in one go (perPage=9530). A fix might be to make a looping request in batches of 100 entries per page.

karthink avatar Jul 08 '22 17:07 karthink

Update: I proposed a fix in #14.

karthink avatar Jul 08 '22 19:07 karthink