Approving action request does nothing

Expected behavior

We would expect that when an eligible approver selects “Approve” for the request, the request would be moved to the “History” tab and out of the “To Review” tab. We would also expect that the updates contained in the action would apply once the request is approved.

Actual behavior

Selecting “Approve” on the request does nothing. It does not get cleared from the “To Review” tab and the updates contained in the action do not get made. However - clicking “Reject” on the request does in fact clear it, but when we tried to make the necessary update in the action afterwards, we faced the same issue with the request not getting approved.

Failure Logs

There are no errors or logging messages.

Context

"forest-express": "^7.5.0",
"forest-express-sequelize": "^6.3.13",
"sequelize": "^4.44.3",

Hi @rwinz, and welcome to our community

I’m currently investigating this, but I’m currently not able to reproduce this issue.
Would you mind sharing your project name so I can check what’s happening on our end?
Also, do you have any error toastr/in the network tabs of your browser console ?

Thanks for your help @jeffladiray!

I have also learned that our other teams are experiencing this issue as well.

We have checked the browser console as you suggested, and here is what we found:

Request URL: https://api.forestadmin.com/api/custom-actions/1209662-Update%40%40%40Institution
Request Method: GET
Status Code: 404 Not Found

Response:

Error
Cannot GET /api/custom-actions/1209662-Update%40%40%40Institution

Hello @rwinz ,

Could you share with us how you defined your smart action please?
More information like your project name could help us too :slight_smile:

Do you know when this error appears in the console (when you approve it? when you load the page? …)
Does the “Update institution” action still exist on your collection?

Let me know :slight_smile:

Hi @Guillaume_Cisco ! Thanks for your help and sorry for the delay.

The project name is woodpecker. The error that I detailed in my last post appears when trying to approve the request. And yes, the “Update Institution” action still exists on the collection.

Here is how we are defining our Update Institution action:

A snapshot from forest/institutions.js:

Liana.collection('Institution', {
      searchFields: ['id', 'name'],
      actions: [
        {
        name: 'Update Institution',
        endpoint: '/forest/actions/update-institution',
        type: 'single',
        fields: {
            field: 'id',
            type: 'Number',
            isRequired: true
            },
            {
             field: 'name',
             type: 'String',
             isRequired: true,
             },
        values: getValuesUpdateInstitution,
      }]
});
  

where getValuesUpdateInstitution() gets the institution given the context.
This action is working as expected except for when trying to approve the request.

Hi @rwinz,

I am wondering how this call to https://api.forestadmin.com/api/custom-actions/... can be done as there is no such route on the Forest Admin API.

Could you share a screencast of your browser, with the network tab of your developer console opened, while trying to approve an approval request?
It would help a lot to understand what is happening here.

Thanks for your help.

Hi @rwinz,

Your issue appears to be very strange! Let’s try to finally find where it comes from.

To sum up:

  • This action exists for a while
  • It always works when not used with the approval flow
  • It always works when used with the approval flow if the same user self approve its request
  • It never works when used with the approval flow if a user tries to approve someone else request
  • This problem occurs only for this specific action
    Am I correct?

I’ve tried to reproduce your error with the same settings for my action but no luck.
It’s pretty hard to tell where it could come from.

Sorry but would you mind to share your network again (in the failing scenario), and clean everything before your final click on “approve”. It should look like something like this:

From this, hopefully we will be able to understand what call is missing / wrong and identify your problem.

Side note: it is something possible for you and your team at some point to remove this action and put it live back again and see if the problem persists?

Hello @rwinz,

Can you share with us the following info?

  • The content of the response of the query on /action-approval/:id? In your screenshot we only see the headers, and I would like to know the actual JSON sent by the server
  • In the same way, you’ll find calls when loading an environment, on https://api.forestadmin.com/api/renderings/[yourProject]/[yourEnv]/[yourTeam], and I would like to know the extract of the received json:
    • I would like to know the content of an object in the included property, corresponding to your custom action.

I suspect that there is a mismatch between the two ids, that leads to your error. Can you find this info and share them with us?

1 Like

It looks like you are correct, the id’s do not seem to match.

Here is the contents of the object in the included array that corresponds to our custom action ‘Update Institution’:

{
      type: "customActions",
      id: "1525461-Update@@@Institution",
      attributes: {
        allow_self_approval: true,
        base_url: null,
        confirmation: false,
        download: false,
        endpoint: "/forest/actions/update-institution",
        hooks: { load: false, change: [] },
        http_method: "POST",
        is_hidden: false,
        name: "Update Institution",
        position: 5,
        redirect: false,
        require_approval: true,
        type: "single",
        restricted_to: { roles: [], users: [] },
        approved_by: { roles: [203], users: [] },
      },

And here is the screenshot of the response to https://api.forestadmin.com/api/action-approvals/37411

Hi :wave: @rwinz can you give me the name of your project, the team and the environment on which you experienced the issue?

Project name: woodpecker
Environment: Production
Team: IE - Administrators

Hi @rwinz,

I’m not able to locate this action in the IE - Administrators Production environment. Did you reset this smart action?

Did you try the @anon34731316 solution?

it is something possible for you and your team at some point to remove this action and put it live back again and see if the problem persists?

The action is called ‘Update Institution’ on the Institutions collection – I am seeing it on the production environment while I am on the IE - Administrators team.

We are not able to try that solution because we would have to release without the action and then wait until another release window before we are able to put it back.

This is the url that I used in order to get the action object from the included array, as suggested in a another post:

https://api.forestadmin.com/api/renderings/woodpecker/Production/IE%20-%20Administrators

Gives:

{
      type: "customActions",
      id: "1525461-Update@@@Institution",
      attributes: {
        allow_self_approval: true,
        base_url: null,
        confirmation: false,
        download: false,
        endpoint: "/forest/actions/update-institution",
        hooks: { load: false, change: [] },
        http_method: "POST",
        is_hidden: false,
        name: "Update Institution",
        position: 5,
        redirect: false,
        require_approval: true,
        type: "single",
        restricted_to: { roles: [], users: [] },
        approved_by: { roles: [203], users: [] },
      },

Hi,

What a long topic :frowning_face: is the issue still appear?

To sum up the situation:

  • Your rendering woodpecker/Production/IE%20-%20Administrators contains the custom action: 1525461-Update@@@Institution.
  • On the UI, you browse the rendering woodpecker/Production/IE%20-%20Administrators then visit the action approval screen.
  • When approving an action, the action-approval 37411 is fetched, and relates to smartAction 1209662-Update@@@Institution

This smart action seems to point to a bad smart action. An error is raised because of this, and the process fail.

This leads us to think the action approval state is broken.
The scenario bringing this is unknown.

Yes the issue is still occurring, and your summation is correct.

Do you have any suggestions for addressing this on our end?

Hi @rwinz :wave: I’m able to reproduce.
The action was launch from another team it’s for what the id is different.
For explain:

  • A user call this action for the team IE the action is 1209662-Update@@@Institution.
  • You try to approve from the IE - Administrator team the action is 1525461-Update@@@Institution

Unfortunately it is a bug. You have two solution.

The first is to migrate to the new roles feature by following this: Migrate to the new role system - Documentation.
And after that have a look on this: Manage roles and permission levels - Documentation to understand how this feature work.

The second is to approve this action on the IE team.

Let me know if that help.

That makes sense, thank you for explaining!

Is this a bug that will be fixed on your end, and if so is there an estimate for when it will be done? Or is there not a plan to fix it, but instead the goal is to migrate to the new role system?

Hey @rwinz :wave: ,

In addition to fixing this bug, our new Roles system will provide you more security and flexibility with your users’ permissions. So that’s definitely something we could consider in this situation.

The migration is pretty smooth and easy to run.

Would you be available in the following days to give you a quick demo and help you migrate to our new Roles system?

You can choose a convenient date and time in my calendar: Calendly - Louis Steenbrink

1 Like

Hello @rwinz,

You should be able to approve the actions across teams without any issue now.
Could you try and tell me if everything works fine?

Thanks! :pray: