boardgamegeekjsclient icon indicating copy to clipboard operation
boardgamegeekjsclient copied to clipboard

Getting invalid keyword error on 'bgg.search.query' in production

Open ZinkNotTheMetal opened this issue 2 years ago • 6 comments

Project background:

NextJS 13 Typescript Using bgg.search.query

 bggClient.search.query({ query: value, type: ['boardgame', 'boardgameexpansion'] })
      .then((queryResults) => {
        // eslint-disable-next-line no-console -- cuz
        console.log('not results problem', queryResults)

        // eslint-disable-next-line no-debugger -- deal with it
        debugger;
        //...

I can never get console to log 'not results problem' it seems like the interface may have changed or something is wrong with the search.

XML response from rest client image

Example code that will fail in next13

    console.log(bggClient)
    bggClient.search.query({ query: 'Monopoly' })
      .then((r) => {
        // eslint-disable-next-line no-console -- is client made?
        console.log(r)
      })
      .catch((error) => {
        // eslint-disable-next-line no-console -- cuz
        console.log('search error:'error)
      })

What is very odd is when I run locally npm run dev it seems to work fine with no issues, my error ONLY occurs when I run in production mode. The test code above returns 'search error' Invalid keyword

image

Debugging next production is extremely difficult so I can't help much more than this unfortunately. I am trying to get this project out soon. If I could get some help with this that would be great or I will have to wrap my own APIs for the search functionality.

I also tried other calls, like 'hot' and 'thing' and they seem to work fine in production mode. Seems to be an error with search from what I can tell.

ZinkNotTheMetal avatar Sep 23 '23 05:09 ZinkNotTheMetal

Console when running locally

image

ZinkNotTheMetal avatar Sep 23 '23 05:09 ZinkNotTheMetal

@LearningProcesss is this still an active project? or should I fork and fix myself

ZinkNotTheMetal avatar Sep 24 '23 16:09 ZinkNotTheMetal

@LearningProcesss is this still an active project? or should I fork and fix myself

Hi, which version are you using?

LearningProcesss avatar Sep 24 '23 17:09 LearningProcesss

It's actually the same in Angular production mode. In Dev everything works fine. In production, I see the XML response from BGG API in network, but then, nothing happens. No console logs, nothing.

LInsoDeTeh avatar May 04 '24 06:05 LInsoDeTeh

The reason for this seems to be the jackson-js library and its annotations. Using parts of the code of this repository with a custom parsing instead of jackson-js works fine in Angular production mode.

LInsoDeTeh avatar May 06 '24 11:05 LInsoDeTeh