Search code examples
mysqlruby-on-railsrubyintellij-idea

Mysql2::Error: Incorrect table name '' - when using AppMap Gem


I recently found out about the AppMap utility and I'm trying to incorporate it into my Rails app via IntelliJ. However, after installing the gem and configuring it, any request I make results throws the following exception:

ActiveRecord::StatementInvalid in UsersController#index

Mysql2::Error: Incorrect table name '' 

It does this for every page, model, request, etc. when using a browser. From my stack trace, it looks like the issue is arising when the roles are being checked in my Ability.rb file (I'm using Devise, CanCanCan, and Rolify for authentication).

If I try to do user.roles in the rails console it produces this:

irb(main):007:0> u.roles
  Role Load (0.5ms)  SELECT `roles`.* FROM `roles` INNER JOIN `` ON `roles`.`id` = ``.`role_id` WHERE ``.`user_id` = 1
(Object doesn't support #inspect)

If I remove the AppMap gem then everything in my application works as intended like it has been previously.

I'm not really sure where to go from here so any input would be greatly appreciated!

Versions:

  • IntelliJ IDEA: 2022.1.4 (Ultimate)
  • AppMap Plugin: 0.21.0
  • AppMap Gem: 0.94.1
  • Rails: 6.1.4.7
  • Ruby: 3.0.1
  • MySql2: 0.5.4
  • CanCaCan: 3.2.2
  • Devise: 4.8.1
  • Rolify: 6.0.0

Solution

  • Thanks for reporting this in the AppMap github issues page. This issue is resolved in v0.95.0 of the appmap-ruby gem. If you need any other help just open another issue or join us in our community slack