Javascript Error on page with custom action

Expected behavior

Permission field when activating a custom action to create a Permission object is populated with choices for that field.

Actual behavior

Spinner in field never stops.
Javascript errors show up (repeats 6-7 times)

Failure Logs

Context

Please provide any relevant information about your setup.

  • Package Version: forest-liana ruby gem 2.15.8
  • Express Version:
  • Sequelize Version:
  • Database Dialect: Postgres
  • Database Version: 12
  • Project Name: Givsum Admin - production (www.givsum.com)

Thanks!

Hi @AlanMcCann,

Welcome to our community and thanks for reaching out!

I’m not really sure I fully understood your problem.
Can you tell us on what page is it happening (a screenshot of that page could be great)?
Is it on the smart actions settings? When trying to do what action exactly?

What’s more, I’m just noticing that your forest-liana version is 2, the last one being the version 5.
It could be a great idea to start by updating your liana, it might resolve the issue you’re encountering and give you access to new features.
Here are the documentation to update to v3, v4 and v5.

Thanks.

I will pursue the upgrade path first and see if that takes care of it. Thanks!

1 Like

I am testing upgrading to v5 of the forest-liana gem.

I am having an issue with a badly formatted json schema file due to an issue with rendering newlines

We have a database field that has a default value with new-line characters encoded

"Dear %{first_name}, thank you for \n your message \n\nYour friends at Givsum"

However, the json produced didn’t escape the newlines. and it breaks the json

"type": "String",
      "default_value": "Dear %{first_name}, thank you for
your message

Your friends at Givsum"

It should render as

"type": "String",
      "default_value": "Dear %{first_name}, thank you for \n your message \n\nYour friends at Givsum"

I fixed the escaping issue with a fix to our schema and models.

Hi:

I have upgraded to v5.2.2 and I’m still getting the error just loading any given page. See info below. This is in both our production and staging environments.

e.g. https://app.forestadmin.com/Givsum%20Admin/Production/Admin/data/218764/index/record/218764/1189158/summary

Error

vendor-be9ccf5311e8a3a161b6bd52457990b5.js:24218 Uncaught TypeError: Cannot read property 'widget' of null
    at i.get (client-dc0c7e4d820ee5257812fe7e2d2926c1.js:9516)
    at Pe (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2672)
    at vendor-be9ccf5311e8a3a161b6bd52457990b5.js:1935
    at J (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2616)
    at n.r.compute (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:1935)
    at n.value (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:1929)
    at e.t.initialize (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4318)
    at e.t.peek (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4313)
    at Object.evaluate (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4447)
    at e.t.evaluate (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4373)
    at e.t.evaluateSyscall (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4709)
    at e.t.evaluateInner (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4701)
    at e.t.evaluateOuter (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4701)
    at e.o.next (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4867)
    at e.o.execute (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4866)
    at e.t.insert (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4784)
    at e.t.nextInsert (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4354)
    at e.t.nextAppend (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4352)
    at e.t.sync (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4344)
    at i.o.evaluate (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4794)
    at e.r.execute (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4769)
    at e.t.rerender (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4799)
    at e.s.render (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2195)
    at n.r._renderRoots (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2222)
    at n.r._renderRootsTransaction (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2226)
    at n.r._revalidate (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:2226)
    at t.invoke (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5003)
    at e.t.flush (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:4995)
    at e.t.flush (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5009)
    at e.n._end (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5072)
    at e.n.end (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5028)
    at e.n._run (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5074)
    at e.n._join (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5073)
    at e.n.join (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:5039)
    at d (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3910)
    at vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3614
    at a (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3827)
    at Object.handleEvent (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3614)
    at n.handleEvent (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3539)
    at HTMLAnchorElement.<anonymous> (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:3564)
    at HTMLBodyElement.dispatch (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:1477)
    at HTMLBodyElement.g.handle (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:1472)
    at HTMLBodyElement.r (vendor-be9ccf5311e8a3a161b6bd52457990b5.js:24218)

Hi @AlanMcCann,

Could you give me more context about your original issue ?
I’m currently not able to reproduce, but the error seems to indicate a field or collection that is not found. Did you recently add a new field on your setup ?

Feel free to add any information that is relevant for me to reproduce on my end :pray:

Hi @jeffladiray:

Thanks.

I’m currently not able to reproduce, but the error seems to indicate a field or collection that is not found. Did you recently add a new field on your setup ?

I agree with your assessment.

One concern I have is how much information I can share here given the public nature of this forum.

The error occurs on 3 objects - business, opportunity, organization

We have custom actions that are the same for each

class Forest::Opportunity
  include ForestLiana::Collection

  collection :Opportunity
  action 'Add permission', fields: [{ field: 'User Email', type: 'String'},
                                      {field: 'Permission', type: 'Enum', enums: ['account_admin','admin']}],
                           type: 'single'
end

There is also a rails controller to handle the action.

What other information can I provide?

Maybe a small loom clip of the issue would help here.

If that’s not possible on your end for confidentiality purpose, a complete description of the flow triggering this error would help me reproduce this issue, or at least find what can cause it.

Does it happend on all of your environments ? Or on a specific one ?
Do you have any others errors (Like HTTP calls failling, stacktrace on your rails app, etc…) that would help locate this issue ?

Ok - thanks.

I removed all custom actions to see if that would help but it didn’t.

Here is a link to a screen recording of the issue. It only happens on three models as you will see.

https://us02web.zoom.us/rec/share/g6ziRitJ_UkTpZEnJqISP3plCfzVg5Grhlm-e_wKo974o-sD6a-x8GlrDs5n9oh-.LVD7y9gS5fmJCq8X Passcode: xD#0q.EC

Hi @AlanMcCann, and sorry for the delayed response.
I’ve dig through a lot of things, and from what I can see there is specific field that is causing the issue. I can’t find the culprit though …

In your video, it seems like a few records are still rendered, so I guess we could reduce the number of potential fields causing this. Do you notice any patterns on those fields that could help us located the exact issue? Any new field that have been introduced recently?
Scrolling inside the table view might help locating the field in question, maybe the table view does not render fully the last line.

Also, this issue happens on all your environment? or is specific to your production?

(I’m still to find the cause of this, and will update my post if anything interesting appear)

2 Likes

Ahh. Ok - thanks. I will check that. It happens in all environments. Checking it now.

I’m still working on trying to figure out what changed to cause the issue.

1 Like

I haven’t been able to figure out what fields might be causing it - would I remove fields from the schema to test it out?

Hi @AlanMcCann,

I tried a lot of things on my end, but I’m still not able to reproduce your issue.

would I remove fields from the schema to test it out?

This could be an idea, but I think that just “hiding” fields via the layout editor might just work as well to see which field is causing an issue (It will avoid code edition on your end). Since you have 3 collections that have the exact same behavior, I also guess that it could be a shared field between theses tables.

Let me know if you find something :pray:

Thanks - I was able to get to the problematic field - tags from the acts-as-taggable-on gem - and disable it so we can use everything properly.

In order to help see if this type of field can be fixed, I have shared info below.

the rails schema for the associated tables are

  create_table "taggings", id: :serial, force: :cascade do |t|
    t.integer "tag_id"
    t.integer "taggable_id"
    t.string "taggable_type", limit: 255
    t.integer "tagger_id"
    t.string "tagger_type", limit: 255
    t.string "context", limit: 128
    t.datetime "created_at"
    t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
    t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context"
  end

  create_table "tags", id: :serial, force: :cascade do |t|
    t.string "name", limit: 255
    t.integer "taggings_count", default: 0
    t.index ["name"], name: "index_tags_on_name", unique: true
  end

The json schema for every model is as follows

{
      "field": "tags",
      "type": "String",
      "default_value": null,
      "enums": null,
      "integration": null,
      "is_filterable": false,
      "is_read_only": false,
      "is_required": false,
      "is_sortable": true,
      "is_virtual": false,
      "reference": null,
      "inverse_of": null,
      "relationship": "HasMany",
      "widget": null,
      "validations": []
    }
1 Like

Hell @AlanMcCann,

It looks like the reference key for your tags field should not be null as it is using a HasMany relationship.
Could you check if the reference is correctly declared in your model.

Let me know if it helps.

With using the act-as-taggable-on gem, we just include acts_as_taggable in each rails model using it. The issue is likely deep in the implementation of that gem as our other tables that use polymorphic relationships we define and manage seem to be ok in Forest. It is likely beyond our resources to look into fixing it at this point so if there isn’t something your team can look at, we can put this issue to rest for now.

1 Like