Switching to the New Module Library

Hi Joel. Thanks for all your hard work! I’m getting the APIError: 401 Unauthorized: Unauthorized message when I try to edit a module page that I own. I’ve logged out and in twice. What additional information can I provide to help you help me. Thanks. Al

I am baffled by what I’m seeing here:


The XMLHttpRequest handling uploads is showing that its response and responseText properties are the string {"error":"Already exists"}, and simultaneously that they are both the empty string. I don’t know how that’s possible.

@uckelman this are some wait animation examples :

I also get the dreaded “APIError: 401 Unauthorized: Unauthorized” when trying to add a new module to Bomber Command.


I am a co-owner of that project.

I will need to see what HTTP requests your browsers are making when you have that error. If you’re using Firefox, you can find that under Tools > Browser Tools > Web Developer Tools.

Here you are:


1 Like

Could I also see the entire value for the Cookie header in the request? Some of it is truncated.

Are you seeing this problem on any requests other than when you’re trying to upload a file?

I really thought that this was not a value you would like to see to the full extent :slightly_smiling_face:

Cookie
refresh=67HVCtse37XIigfitGVThHpMJwHkd9QruhDfZamZsoLiZd54BFvFr6VOtN6o5PA2; name=; username=steenkh; wikidb_session=oo15llsm8k1j0gj14b8jgqt33nge6aku; token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjE4NzczLCJpYXQiOjE3NDk5ODgyMDMsImV4cCI6MTc0OTk4ODUwM30.bCNvW9qNaWOBS7gB9F7bZcCDLZozN-8uo65d180m8yA

1 Like

That was exactly what I needed to diagnose the problem. Thank you.

There are two tokens that the frontend has—the access token, and the refresh token. The access token is sent with each write request for authentication; the refresh token is sent when a new access token needs to be issued. I accidentally got them reversed when doing some cleanup yesterday, which you can see if you compare the string in the Authorization header with what’s in the Cookie header. The Authorization header should match the value of the token cookie, but instead it matches the value of the refresh cookie.

You should find that this works correctly now.

@steenkh Please log yourself out and back in again, so that you get a new refresh token.

1 Like

I figured out what was happening with the inconsistent reporting of the properties of XMLHttpRequest: Logging to the console happens asynchronously, so if you dump an object to it you get the state of that object at the time the console serializes it to a string, which is not necessarily what it was at the point when you logged it. This is sanity-destroying if you don’t know that console.log() works this way contra to the behavior of basically every other logger anyone has ever designed.

Rant: Why the af would you want a logger that prints the value something has at some arbitrary time in the future instead of the value it had when you did the logging? It’s like somebody was told to add logging, but didn’t understand what logging is.

1 Like

Hi Joel,

I have lost overview of what you believe works and what doesn’t. Could you perhaps make a brief summary of what you believe does work and also a few words on what doesn’t seem to work?

Also, in the interest of not getting swamped in various messages, could you perhaps tell us what you are especially interested in feed-back on, and what information you need?

I fear we’re perhaps iterating over the same problems and we may be distracting from solving the issues, so if we could streamline things a bit, I think it would be good on all parties.

Thanks.

Yours,
Christian

1 Like

It works now, thanks! :+1:

I’ve done it.

1 Like

There is at this point only one outstanding systemic problem of which I’m aware, namely that I’m not sure I have appropriate timeout settings for the Game Library Service and the gateway in front of it, which could cause uploads of large files or uploads over slow connections to fail.

Presently, I’m not seeking any specific information I don’t already have.

What I’m doing next is:

  • collecting together all of the problem reports for individual projects I’ve received so far, so I have some sort of list I can work from.
  • writing something very short explaining the library concepts.
2 Likes

Something has changed. Attempting to create a project, now receiving (instead of the 400 sort) this error:
TypeError: this.authAndJSONHeaders is not a function

I missed changing a function name in two places. Try now.

Don’t you mean creating a package?

I get

APIError: 422 Unprocessable Entity: Unprocessable entity

when trying to create a project.

BTW, as far as I can tell from the code, the name entered in https://vassalengine.org/library/new becomes the game name - not the project name, and there’s no way, as far as I can tell, to either change the game nor project name later on. I guess the new page should really have many more fields in its form to set these things separately, or you could fetch them from BGG.

What seems to work:

  • Module uploads
  • Module downloads
  • Package creation
  • Editing README.md
  • Editing parts of the project meta data (though not project name, etc.)
  • Adding one self as player
  • …?

What doesn’t seem to work

  • Project creation - gives APIError: 422 Unprocessable Entity: Unprocessable entity. Hidden interface at https://vassalengine.org/library/new
  • Removal of packages - no interface
  • Removal of files - no interface
  • Editing parts of the project meta data (project name, game name, etc.) - no interface
  • Adding or removing screenshots - no interface
  • …?

Yours,
Christian

For what input?

These are working as expected at present.

I believe you can edit the game name. If not, I’d like to see evidence for that. The project name isn’t intended to be editable at present.

" Project creation - gives APIError: 422 Unprocessable Entity: Unprocessable "
I was referring to project creation. I am now back to the 422 error.

On what input? I cannot troubleshoot it if I don’t know what the input is.