misskey-dev / misskey

🌎 A completely free and open interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
9.98k stars 1.35k forks source link

Integrations causing internal server error #8987

Closed y4my4my4m closed 1 year ago

y4my4my4m commented 2 years ago

💡 Summary

When trying to login via integration (all 3), an internal server error occurs.

🥰 Expected Behavior

Should login using the integration service

🤬 Actual Behavior

Twitter

0|npm  |   TypeError: autwh is not a function
0|npm  |       at getTwAuth (file:///home/misskey/packages/backend/built/server/api/service/twitter.js:52:1
6)
0|npm  |       at runMicrotasks (<anonymous>)
0|npm  |       at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|npm  |       at async file:///home/misskey/packages/backend/built/server/api/service/twitter.js:78:20
0|npm  |       at async bodyParser (/home/misskey/packages/backend/node_modules/koa-bodyparser/index.js:95:
5)
0|npm  |       at async file:///home/misskey/packages/backend/built/server/api/index.js:27:5
0|npm  |       at async cors (/home/misskey/packages/backend/node_modules/@koa/cors/index.js:56:32)
0|npm  |       at async /home/misskey/packages/backend/node_modules/koa-mount/index.js:58:5
0|npm  |       at async file:///home/misskey/packages/backend/built/server/index.js:49:9

Github

|npm  |   Error: Cannot send secure cookie over unencrypted connection
0|npm  |       at Cookies.set (/home/misskey/packages/backend/node_modules/cookies/index.js:94:11)
0|npm  |       at file:////home/misskey/packages/backend/built/server/api/service/github.js:85:17
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at /home/misskey/packages/backend/node_modules/@koa/router/lib/router.js:363:16
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at /home/misskey/packages/backend/node_modules/koa-compose/index.js:34:12
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/@koa/router/lib/router.js:368:31)
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at bodyParser (/home/misskey/packages/backend/node_modules/koa-bodyparser/index.js:95:11)
0|npm  |       at runMicrotasks (<anonymous>)
0|npm  |       at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|npm  |       at async file:///home/misskey/packages/backend/built/server/api/index.js:27:5
0|npm  |       at async cors (/home/misskey/packages/backend/node_modules/@koa/cors/index.js:56:32)
0|npm  |       at async /home/misskey/packages/backend/node_modules/koa-mount/index.js:58:5
0|npm  |       at async file:///home/misskey/packages/backend/built/server/index.js:49:9

Discord

|npm  |   Error: Cannot send secure cookie over unencrypted connection
0|npm  |       at Cookies.set (/home/misskey/packages/backend/node_modules/cookies/index.js:94:11)
0|npm  |       at file:////home/misskey/packages/backend/built/server/api/service/discord.js:87:17
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at /home/misskey/packages/backend/node_modules/@koa/router/lib/router.js:363:16
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at /home/misskey/packages/backend/node_modules/koa-compose/index.js:34:12
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/@koa/router/lib/router.js:368:31)
0|npm  |       at dispatch (/home/misskey/packages/backend/node_modules/koa-compose/index.js:42:32)
0|npm  |       at bodyParser (/home/misskey/packages/backend/node_modules/koa-bodyparser/index.js:95:11)
0|npm  |       at runMicrotasks (<anonymous>)
0|npm  |       at processTicksAndRejections (node:internal/process/task_queues:96:5)
0|npm  |       at async file:///home/misskey/packages/backend/built/server/api/index.js:27:5
0|npm  |       at async cors (/home/misskey/packages/backend/node_modules/@koa/cors/index.js:56:32)
0|npm  |       at async /home/misskey/packages/backend/node_modules/koa-mount/index.js:58:5
0|npm  |       at async file:///home/misskey/packages/backend/built/server/index.js:49:9

📝 Steps to Reproduce

  1. Add integration key/secret
  2. Attempt to login
  3. Error occurs

📌 Environment

Misskey: 12.110.1 Node.js: v16.15.0 PostgreSQL: 13.4 Redis: 6.2.5 Vue: 3.2.31

Running on EC2 AWS, using pm2 to run Node process.

自分の環境の問題かもしれないですが、原因よく分からない。ホームページが正しくHTTPS認証されているけど、、

y4my4my4m commented 2 years ago

I tried setting app.proxy = true in other files, but it didnt seem to work. Anyway it's set in the server/index.ts 参考書:https://github.com/koajs/koa/issues/974

y4my4my4m commented 2 years ago

I fixed the github and discord one.

I had to modify the /etc/nginx/mysite.conf and uncomment these:

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;

Twitter still not working, somehow.

y4my4my4m commented 2 years ago

https://github.com/syuilo/autwh のバグかな? 🤔

// index_test.js
const autwh = require('autwh');
const _a = autwh({
  consumerKey: 'XXX', //実際のキー
  consumerSecret: 'XXX',
  callbackUrl: 'https://mysite.com/api/tw/cb'
});

console.log(_a);

node index_test.js にすると TypeError: autwh is not a functionエラーがでます。

y4my4my4m commented 2 years ago

なんかおかしいけど、だめなworkaroundで解決できた。

で想定通りに動いています

But of course that's a terrible way to go about it.

tamaina commented 2 years ago

@syuilo 直してたりする?

syuilo commented 2 years ago

特にはまだ対応してない

futchitwo commented 1 year ago

外部連携は廃止されたのでcloseして良さそうです