agent-nodejs icon indicating copy to clipboard operation
agent-nodejs copied to clipboard

TypeError: Class CustomErrorStrategy extends undefined antlr4 DefaultErrorStrategy

Open glarivie opened this issue 11 months ago • 4 comments

Actual behavior

Using @forestadmin/[email protected] with @forestadmin/[email protected] throws the following error:

node_modules/@forestadmin/datasource-customizer/dist/decorators/search/custom-parser/custom-error-strategy.js:4
class CustomErrorStrategy extends antlr4_1.DefaultErrorStrategy {
                                           ^
TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (node_modules/@forestadmin/datasource-customizer/dist/decorators/search/custom-parser/custom-error-strategy.js:4:44)

Context

  • DefaultErrorStrategy is from the antlr4 package, which had an old, related issue: https://github.com/antlr/antlr4/issues/4287
  • Import was introduced in a recent PR: https://github.com/ForestAdmin/agent-nodejs/pull/780/files#diff-e118123d0895dab51705d921cb6fdd344a27fcc717c457d9d1de3728e894c8e1R1

glarivie avatar Feb 25 '24 15:02 glarivie

Hello @glarivie,

Could you provide more information on when you're encountering this issue, I have not been able to reproduce using @forestadmin/[email protected]

DayTF avatar Feb 26 '24 12:02 DayTF

After investigating, it turns out that the cause of the problem is our packages manager: yarn 4. The problem does not occur with a package manager such as npm or yarn 1. And I can confirm that @forestadmin/[email protected] works correctly with yarn 4.

glarivie avatar Mar 15 '24 17:03 glarivie

I don't know why but [email protected] (instead of [email protected]) is installed for @forestadmin/[email protected] and @forestadmin/[email protected]. I need to use this trick in my package.json to deal with this issue :

"resolutions": {
  "antlr4": "4.13.1-patch-1"
}

glarivie avatar Mar 15 '24 20:03 glarivie

I had the same issue. Thanks a lot for the tip @glarivie !

tommyfr avatar Jun 10 '24 20:06 tommyfr