pwp-app / pixiviz-server

Backend server of Pixiviz
https://pixiviz.pwp.app
Apache License 2.0
9 stars 2 forks source link

Cannot read property 'refresh_token' of undefined #5

Closed Ruriko closed 2 years ago

Ruriko commented 2 years ago

I have updated the script to latest version and now I can't run server. In my error log it say:

2022-02-21 11:06:18,423 ERROR 1770 [-/195.170.172.241/-/2ms GET /v1/illust/search?word=koikatsu&page=1] nodejs.TypeError: Cannot read property 'refresh_token' of undefined
    at PixivService.refreshToken (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:86:81)
    at PixivService.login (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:69:16)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async PixivService.getHeaders (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:27:7)
    at async PixivService.generalRequest (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:49:16)
    at async PixivService.fetchFromRemote (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:112:17)
    at async PixivService.searchIllust (/var/www/drawanime.art/htdocs/pixiviz-server/app/service/pixiv.js:123:12)
    at async IllustController.search (/var/www/drawanime.art/htdocs/pixiviz-server/app/controller/v1/illust.js:20:26)
    at async compressMiddleware (/var/www/drawanime.art/htdocs/pixiviz-server/node_modules/koa-compress/lib/index.js:52:5)
    at async notFoundHandler (/var/www/drawanime.art/htdocs/pixiviz-server/app/middleware/notFoundHandler.js:5:5)

I don't know why it can't read refresh_token cause I have included it in keys.js

backrunner commented 2 years ago

There will be a cache file called refreshToken under the folder where you put the server, you can check it. If server doesn't have enough permissions to create the cache file, this error may occur

BTW: please make sure the refresh_token is available, if it's already outdated, you also may meet this error.