chilli-axe/mpc-autofill

Exception(s) when resuming order using --skipsetup

Closed this issue ยท 7 comments

I posted about this on Discord, but the explanation started to become so long winded I felt it was better to move it here instead.

My first attempt at running the program stalled out after ~300 cards in a 396 order. So I saved the project, and then re-ran autofill with the --skipsetup flag. In the Chrome window that was launched, I logged in to MPC, went to the saved project and then resumed the program. As expected, the program filled out the remaining card slots. However, once the program had filled all slots, it threw an exception:

The program has been started with --skipsetup, which will continue
uploading cards to an existing project. Please sign in to MPC and select an existing project
to continue editing. Once you've signed in and have entered the MPC project editor, return to
the console window and press Enter.

An uncaught exception occurred: Message: javascript error: displayTotalCount is not defined
  (Session info: chrome=102.0.5005.115)
Stacktrace:
Backtrace:
        Ordinal0 [0x00DBD953+2414931]
        Ordinal0 [0x00D4F5E1+1963489]
        Ordinal0 [0x00C3C6B8+837304]
        Ordinal0 [0x00C3F0B4+848052]
        Ordinal0 [0x00C3EF72+847730]
        Ordinal0 [0x00C3F8EA+850154]
        Ordinal0 [0x00C95249+1200713]
        Ordinal0 [0x00C8449C+1131676]
        Ordinal0 [0x00C94812+1198098]
        Ordinal0 [0x00C842B6+1131190]
        Ordinal0 [0x00C5E860+976992]
        Ordinal0 [0x00C5F756+980822]
        GetHandleVerifier [0x0102CC62+2510274]
        GetHandleVerifier [0x0101F760+2455744]
        GetHandleVerifier [0x00E4EABA+551962]
        GetHandleVerifier [0x00E4D916+547446]
        Ordinal0 [0x00D55F3B+1990459]
        Ordinal0 [0x00D5A898+2009240]
        Ordinal0 [0x00D5A985+2009477]
        Ordinal0 [0x00D63AD1+2046673]
        BaseThreadInitThunk [0x76CEFA29+25]
        RtlGetAppContainerNamedObjectPath [0x77597A9E+286]
        RtlGetAppContainerNamedObjectPath [0x77597A6E+238]

Press Enter to exit.

So I saved the project again, and went through the motions once more (run program, log in, open saved project). The program tried to navigate to the "Customize Fronts" page and was trying to brining up the "Chose card number" prompt, but eventually timed out after 300 seconds and threw another exception (unfortunately I didn't capture that exception). The timeout I could kinda understand. Loading the Customize Fronts page takes a lot of time here in northern EU, so all card thumbnails aren't loaded in 5 minutes.

So once more, I started the program (with --skipsetup). This time, I opened the saved project, and manually navigated to the "Customize Fronts" page and left it there for a good 15 minutes until the page was fully loaded. I even reloaded the page to make sure all the images were locally cached. Then, I moved the page to the "Customize Backs" page, and resumed autofill. The program now correctly navigated to the "Customize Fronts" page first, showed the "card number" prompt, closed it, did some processing (I guess it checked that all slots were filled), and then proceeded to "Customize Backs" and started uploading and filling in cards as it should.


So I think there are several things going on here:

The first issue I don't know what's up with. I tried to replicate it several times, with different order files and by terminating the process and resuming it several times without luck. Might have been a one-off, or something on MPCs side.

The other is that each instance of Chrome spawned from autofill has it's own cache, so loaded pages takes a very long time. I am not sure it is possible to reuse caches between runs, so if it aren't I think just extending the time you allow on the first render. Another alternative would be to have the program open the "Customize Fronts" page and let it fully load, then open the "Customize Backs" and let it fully load, then start the process over, to ensure previous images are cached.

Sorry for the long write-up without having any success replicating the issue. Hope it's somewhat useful, but if it seems like pure noise you are free to close it. Thanks again for a great program.

When using the --skipsetup option, I too get the error: An uncaught exception occurred: Message: javascript error: displayTotalCount is not defined.

When I tried to follow Gikkman's workaround (letting the "Customize Fronts" page load, then navigating to the "Customize Backs" page) I got the error: An uncaught exception occurred: Message: javascript error: Cannot read properties of null (reading '0')

I had similar issues with my 504 card order, and I was able to resume the script using OP's workaround, I'll synthetize the steps here

Workaround

  1. start autofill.exe with --skipsetup
  2. navigate to the "Customize Fronts" page and let all images load
  3. navigate to "Customize Backs" (only if the script reached the backs step before)
  4. resume the script by pressing the Enter key

@duckyb I'm putting together a 3000+ card order for my whole playgroup and your workaround saved me from having to manually enter all those backs. Thank you so much. When I get the time, I'll try to contribute and fix this bug because I imagine this is gatekeeping a lot of users.

I think fixing this issue and #107 are imperative to the usability of this tool.

thanks @duckyb for posting your workaround! apologies for the tool's interaction with MPC's site in the initial stage of skipsetup mode being inconsistent. my priorities for when i have time to work on the local tool again are:

  • investigating the source of this inconsistency and fixing it
  • reviewing and merging #103, which includes functionality for passing the user's username and password to MPC
  • investigating and implementing a solution to #107, which would require the user to either specify a username/password or manually log in to MPC

things are a bit chaotic for me atm (moving house) so it might be a few days.

I think the PR I submitted few weeks agos (#103) would also resolve the #107 since each XML file found in the current folder are upload and saved as a distinct "Saved project" in the MPC user's account. This way, it allows the user to create multiple smaller decks if desired. This is also useful when a group of friends wants to combine multiple decks in a single order.

Bonus : it is also really easy to set a different background image for each deck :)

If anyone would like to test my PR, feel free to clone this : git@github.com:courchef/mpc-autofill.git

edit: I'm afraid the feature I've added does not work well with the --skipsetup option. I didn't bother testing it since uploading multiple small decks can be easily resumed if the process fails in the middle by simply removing/renaming the XML files corresponding to uploaded decks from the current folder and restarting the process.

resolved by 111548c