torikushiii / starrail-auto

Auto check-in and others for Honkai: Star Rail
https://ko-fi.com/torikushiii
GNU Affero General Public License v3.0
106 stars 23 forks source link

TypeError: Cannot read properties of undefined (reading 'name') and API error when signing Error #33

Closed Capoouo closed 10 months ago

Capoouo commented 10 months ago

The complete error code is here

2023-12-31 00:00:00 TypeError: Cannot read properties of undefined (reading 'name') 2023-12-31 00:00:00 at Cron.checkInChecker (file:///usr/src/app/crons/check-in-checker/index.mjs:22:31) 2023-12-31 00:00:00 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

2024-01-02 00:00:01 message: 'API error when signing', 2024-01-02 00:00:01 args: { 2024-01-02 00:00:01 statusCode: 200, 2024-01-02 00:00:01 body: { 2024-01-02 00:00:01 data: null, 2024-01-02 00:00:01 message: 'Too many attempts. Please try again later.', 2024-01-02 00:00:01 retcode: -500004 2024-01-02 00:00:01 } 2024-01-02 00:00:01 } 2024-01-02 00:00:01 }

Error after adding add checkInChecker

torikushiii commented 10 months ago

I've added delay on every successful request on latest commit, hopefully that should fix it

torikushiii commented 10 months ago

if the issue still persist, you can comment here or re-open this issue

Capoouo commented 10 months ago

the issue still persist

2024-01-03 00:00:01 2024-01-03 00:00:01 [INFO]: { 2024-01-03 00:00:01 message: 'API error when signing', 2024-01-03 00:00:01 args: { 2024-01-03 00:00:01 statusCode: 200, 2024-01-03 00:00:01 body: { 2024-01-03 00:00:01 data: null, 2024-01-03 00:00:01 message: 'Too many attempts. Please try again later.', 2024-01-03 00:00:01 retcode: -500004 2024-01-03 00:00:01 } 2024-01-03 00:00:01 } 2024-01-03 00:00:01 }

2024-01-03 00:00:01 TypeError: Cannot read properties of undefined (reading 'name') 2024-01-03 00:00:01 at Cron.checkInChecker (file:///usr/src/app/crons/check-in-checker/index.mjs:22:31) 2024-01-03 00:00:01 at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

The problem is the same

Capoouo commented 10 months ago

if the issue still persist, you can comment here or re-open this issue

I can't reopen this issue, only you can reopen it

torikushiii commented 10 months ago

I've added missing timeout, hopefully this will fix it. You can close this issue if the problem have been fixed

Capoouo commented 10 months ago

I've added missing timeout, hopefully this will fix it. You can close this issue if the problem have been fixed

OK I'll give it a try. Thanks for the update

Capoouo commented 10 months ago

Got a new Error, the following is the complete error message

2024-01-04 00:00:00 2024-01-04 00:00:00 [INFO]: { 2024-01-04 00:00:00 message: 'API error when signing', 2024-01-04 00:00:00 args: { 2024-01-04 00:00:00 statusCode: 200, 2024-01-04 00:00:00 body: { 2024-01-04 00:00:00 data: null, 2024-01-04 00:00:00 message: 'Too many attempts. Please try again later.', 2024-01-04 00:00:00 retcode: -500004 2024-01-04 00:00:00 } 2024-01-04 00:00:00 } 2024-01-04 00:00:00 }


2024-01-04 00:00:05 2024-01-04 00:00:05 [INFO]: { 2024-01-04 00:00:05 message: 'API error when signing', 2024-01-04 00:00:05 args: { 2024-01-04 00:00:05 statusCode: 200, 2024-01-04 00:00:05 body: { 2024-01-04 00:00:05 data: null, 2024-01-04 00:00:05 message: "You've already checked in today, Trailblazer~", 2024-01-04 00:00:05 retcode: -5003 2024-01-04 00:00:05 } 2024-01-04 00:00:05 } 2024-01-04 00:00:05 }

torikushiii commented 10 months ago

I'm currently re-working the codebase, in the meantime you can navigate to crons > index.mjs and put "//" at the definitions array // checkInChecker to disable this cron for now

Capoouo commented 10 months ago

OK, thanks

torikushiii commented 10 months ago

Hello, I've finished re-worked the entire codebase and I did not see anymore errors like you described.

Do note that the config files are not the same as the old one, but you can copy the values over. If you have any questions, feels free to ask.

Capoouo commented 10 months ago

Hello, I've finished re-worked the entire codebase and I did not see anymore errors like you described.

I tried new codebase and got new error , And thank you for continuing to update this project <3

2024-01-08 00:21:26 /usr/src/app/index.js:110 2024-01-08 00:21:26 if (!configData.modules.commands.disableAll) { 2024-01-08 00:21:26 ^ 2024-01-08 00:21:26 2024-01-08 00:21:26 TypeError: Cannot read properties of undefined (reading 'disableAll') 2024-01-08 00:21:26 at /usr/src/app/index.js:110:35 2024-01-08 00:21:26 2024-01-08 00:21:26 Node.js v18.19.0

torikushiii commented 10 months ago

sorry for the late fix, I forgot to put that on the example config file. I've added the missing config on the newest commit

Capoouo commented 10 months ago

sorry for the late fix, I forgot to put that on the example config file. I've added the missing config on the newest commit

I added a new commit later, but a new error appeared.

2024-01-08 10:19:08 /usr/src/app/objects/error.js:8 2024-01-08 10:19:08 throw new globalThis.Error("obj must be an object to receive as params"); 2024-01-08 10:19:08 ^ 2024-01-08 10:19:08 2024-01-08 10:19:08 Error: obj must be an object to receive as params 2024-01-08 10:19:08 at new StarRailError (/usr/src/app/objects/error.js:8:10) 2024-01-08 10:19:08 at Object. (/usr/src/app/index.js:94:9) 2024-01-08 10:19:08 at Module._compile (node:internal/modules/cjs/loader:1356:14) 2024-01-08 10:19:08 at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) 2024-01-08 10:19:08 at Module.load (node:internal/modules/cjs/loader:1197:32) 2024-01-08 10:19:08 at Module._load (node:internal/modules/cjs/loader:1013:12) 2024-01-08 10:19:08 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:128:12) 2024-01-08 10:19:08 at node:internal/main/run_main_module:28:49 2024-01-08 10:19:08 2024-01-08 10:19:08 Node.js v18.19.0

torikushiii commented 10 months ago

that error indicates that it didn't detect your config.json file or there's and error on your config file, have you checked it properly?

and config.js is now config.json

Capoouo commented 10 months ago

that error indicates that it didn't detect your file or there's and error on your config file, have you checked it properly?config.json

and is now config.js``config.json

Do I need to change default.config.json to config.json? Or do you just need to change the value of default.config.json?

Capoouo commented 10 months ago

I use default.config.json or config.json and I get this error message, I tested it on my local machine

torikushiii commented 10 months ago

You'd want to rename default.config.json to config.json

If an error still occured, can you navigate from index.js file and go to line 93 and add (e) after catch so it look like this catch (e) and add console.log(e) inside the brackets so it'll look like this

try {
    ...existing code
}
catch (e) {
    console.log(e)
}

And see what the error print out

Capoouo commented 10 months ago

I get this error if I use more than two accounts, but not if I have a single account

torikushiii commented 10 months ago

That's weird, I've been using it for 3 accounts

Does it print out any error with the example I gave?

Capoouo commented 10 months ago

That's weird, I've been using it for 3 accounts

emm ,I'll try the method you provided above first

Capoouo commented 10 months ago

SyntaxError: C:\root\docker_data\starrailauto-my\starrail-auto\default.config.json: Bad control character in string literal in JSON at position 809 at parse () at Module._extensions..json (node:internal/modules/cjs/loader:1453:39) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object. (C:\root\docker_data\starrailauto-my\starrail-auto\index.js:91:16) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) C:\root\docker_data\starrailauto-my\starrail-auto\objects\error.js:8 throw new globalThis.Error("obj must be an object to receive as params"); ^

Error: obj must be an object to receive as params at new StarRailError (C:\root\docker_data\starrailauto-my\starrail-auto\objects\error.js:8:10) at Object. (C:\root\docker_data\starrailauto-my\starrail-auto\index.js:95:9) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49

Node.js v20.10.0

Error log

Capoouo commented 10 months ago

I think I'm stupid, there's a mistake in my account, it's working normally,

If there are any other issues, I will ask you again Thank you<3