ForestAdmin / agent-nodejs

🌱 Node.js agent for Forest Admin
GNU General Public License v3.0
66 stars 7 forks source link

TypeError: Class CustomErrorStrategy extends undefined antlr4 DefaultErrorStrategy #1046

Open glarivie opened 5 months ago

glarivie commented 5 months ago

Actual behavior

Using @forestadmin/agent@1.38.1 with @forestadmin/datasource-customizer@1.43.1 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

DayTF commented 5 months ago

Hello @glarivie,

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

glarivie commented 5 months ago

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/agent@1.38.1 works correctly with yarn 4.

glarivie commented 5 months ago

I don't know why but antlr4@4.13.1 (instead of antlr4@4.13.1-patch-1) is installed for @forestadmin/agent@1.38.1 and @forestadmin/datasource-customizer@1.43.6. I need to use this trick in my package.json to deal with this issue :

"resolutions": {
  "antlr4": "4.13.1-patch-1"
}
tommyfr commented 2 months ago

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