project-mirai / mirai-api-http

Mirai HTTP API (console) plugin
GNU Affero General Public License v3.0
1.66k stars 343 forks source link

在启动第三方sdk后出现java.lang.RuntimeException: Not a http session错误 #634

Closed sayri23 closed 2 years ago

sayri23 commented 2 years ago

完整log如下:

`[root@mooncell Mirai]# ./mcl 20:39:18 [INFO] iTXTech Mirai Console Loader version 2.1.0-71ec418 20:39:18 [INFO] https://github.com/iTXTech/mirai-console-loader 20:39:18 [INFO] This program is licensed under GNU AGPL v3 20:39:20 [INFO] Mirai Console Loader Announcement: Mirai Console Loader 公告栏

如果在图片上传的时候遇到问题请与我们联系 (需要提供图片文件源本) - 如 Unsupported image type for ExternalResource * considering use gif/png/bmp/jpg format. `- Tracker: https://github.com/mamoe/mirai/issues/new/choose

常用资源整合 `- https://mirai.mamoe.net/topic/653

MCL 已推出 2.1.0,更好的支持 Mirai 2.11 的插件系统,建议更新。

20:39:20 [INFO] Verifying "net.mamoe:mirai-console" v2.12.1 20:39:20 [INFO] Verifying "net.mamoe:mirai-console-terminal" v2.12.1 20:39:20 [INFO] Verifying "net.mamoe:mirai-core-all" v2.12.1 20:39:20 [INFO] Verifying "org.itxtech:mcl-addon" v2.0.2 20:39:20 [INFO] Verifying "net.mamoe:mirai-api-http" v2.6.2 20:39:20 [INFO] Verifying "net.mamoe:chat-command" v0.5.1 20:39:20 [WARN] Package "net.mamoe:chat-command" requires "net.mamoe:mirai-console" version 2.0-RC. Current version is 2.12.1 2022-10-13 20:39:21 I/main: Starting mirai-console... 2022-10-13 20:39:21 I/main: Backend: version 2.12.1, built on 2022-07-31 17:49:27. 2022-10-13 20:39:21 I/main: Frontend Terminal: version 2.12.1, provided by Mamoe Technologies 2022-10-13 20:39:21 I/main: Welcome to visit https://mirai.mamoe.net/ 2022-10-13 20:39:21 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 2022-10-13 20:39:21 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation 2022-10-13 20:39:21 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 2022-10-13 20:39:22 I/plugin: Successfully loaded plugin net.mamoe.mirai-api-http v2.6.2 2022-10-13 20:39:22 I/plugin: Successfully loaded plugin Chat Command v0.5.0 2022-10-13 20:39:22 I/plugin: Successfully loaded plugin MCL Addon v2.0.2 2022-10-13 20:39:22 I/main: Prepared built-in commands: autoLogin, help, login, logout, permission, status, stop 2022-10-13 20:39:22 I/Mirai HTTP API: **** 2022-10-13 20:39:22 W/stderr: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 2022-10-13 20:39:22 W/stderr: SLF4J: Defaulting to no-operation (NOP) logger implementation 2022-10-13 20:39:22 W/stderr: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 2022-10-13 20:39:22 I/http adapter: >>> [http adapter] is listening at http://localhost:2240 2022-10-13 20:39:22 I/ws adapter: >>> [ws adapter] is listening at ws://localhost:8080 2022-10-13 20:39:22 I/Mirai HTTP API: Http api server is running with verifyKey: ABC123456 2022-10-13 20:39:22 I/Mirai HTTP API: adaptors: [http,ws] 2022-10-13 20:39:22 I/Mirai HTTP API: **** 2022-10-13 20:39:22 I/MCL Addon: iTXTech MCL Version: 2.1.0-71ec418 2022-10-13 20:39:22 W/MCL Addon: iTXTech Soyuz 未安装,Soyuz MCL Handler 特性已禁用 2022-10-13 20:39:22 I/main: 3 plugin(s) enabled. 2022-10-13 20:39:22 I/main: Auto-login -------- 2022-10-13 20:39:22 W/stderr: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... 2022-10-13 20:39:23 I/Bot.2642084279: Loaded account secrets from local cache. 2022-10-13 20:39:23 I/Bot.2642084279: Saved account secrets to local cache for fast login. 2022-10-13 20:39:23 I/Bot.2642084279: Login successful. 2022-10-13 20:39:24 V/Bot.2642084279: Event: BotOnlineEvent(bot=Bot(--------)) 2022-10-13 20:39:24 I/Bot.2642084279: Bot login successful. 2022-10-13 20:39:24 I/main: mirai-console started successfully. 2022-10-13 20:39:36 E/MAH Access: java.lang.RuntimeException: Not a http session java.lang.RuntimeException: Not a http session at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.session.HttpAuthedSessionKt.unreadQueue(HttpAuthedSession.kt:45) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.dto.CountDTO.getUnreadQueue(parameters.kt:18) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.MessageKt$messageRouter$1$invoke$$inlined$httpAuthedGet$2$1.invokeSuspend(dsl.kt:201) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.MessageKt$messageRouter$1$invoke$$inlined$httpAuthedGet$2$1.invoke(dsl.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.router.MessageKt$messageRouter$1$invoke$$inlined$httpAuthedGet$2$1.invoke(dsl.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.executeResult(Routing.kt:155) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing.interceptor(Routing.kt:39) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invokeSuspend(Routing.kt:107) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invokeSuspend(Authorization.kt:41) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.auth.Authorization$install$1.invoke(Authorization.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler.intercept(HttpRouterAccessHandler.kt:36) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler.access$intercept(HttpRouterAccessHandler.kt:25) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invokeSuspend(HttpRouterAccessHandler.kt:91) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invoke(HttpRouterAccessHandler.kt) at mirai-api-http-2.6.2.jar//net.mamoe.mirai.api.http.adapter.http.feature.handler.HttpRouterAccessHandler$Feature$install$1.invoke(HttpRouterAccessHandler.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invokeSuspend(DefaultEnginePipeline.kt:127) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.engine.DefaultEnginePipelineKt$defaultEnginePipeline$2.invoke(DefaultEnginePipeline.kt) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.loop(SuspendFunctionGun.kt:248) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.proceed(SuspendFunctionGun.kt:116) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.SuspendFunctionGun.execute(SuspendFunctionGun.kt:136) at mirai-api-http-2.6.2.jar[shared]//io.ktor.util.pipeline.Pipeline.execute(Pipeline.kt:78) at mirai-api-http-2.6.2.jar[shared]//io.ktor.server.cio.CIOApplicationEngine$handleRequest$2.invokeSuspend(CIOApplicationEngine.kt:196) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:749) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)`

ryoii commented 2 years ago

[2.6.0] - 2022-8-8

新增

SDK 尝试使用 websocket 的 session 获取 http 模式的未读队列,可以把问题提到 SDK 修复

打开 mah 的 debug 模式可以看到具体请求的接口,进一步验证这个猜想(参考本仓库首页 README 中 setting.yml模板 一节)