Push not changing remote environment

Feature(s) impacted

I am new to Forest Admin and have taken over support from a developer who is no longer available. I am trying to fix a bug in one of our Smart Actions (uploading a CSV and updating the database with new values).

I followed the development workflow and created a new branch (using “forest branch”) and modified the code for that Action. My fix works when I test locally (using “npm start”) and execute the Action on the Development environment in the portal.

Observed behavior

When I push the branch to our remote environment (Test), I get the message that the push was successful:

forest push -e Test
? Push branch 4641-fix-lat-long-override-bug onto Test Yes
√ Branch 4641-fix-lat-long-override-bug successfully pushed onto Test.

However, when I then test the change in the remote environment after the push, my fix has not been applied. The push seems to have absolutely no effect on the remote environment.

Expected behavior

I would expect that my code change would be applied to the remote environment and that I would see the same behavior in that environment that I saw in the local Development environment.

Context

  • Project name: charitywater
  • Team name: Twisthink
  • Environment name: Test
  • Branch name: 4641-fix-lat-long-override-bug
  • Node version: v14.18.3 (locally - I don’t know how to see the environment version)

I saw a similar topic that suggested this may be caused by Node versions out of synch. But I don’t know if this is actually my issue, and I don’t know how to find the Node version for our project on Forest Admin to test that.

Hey @Dean_Martin :wave:

I saw a similar topic that suggested this may be caused by Node versions out of synch

Different nodejs version would trigger an error about schema source or destination being different, so I’m pretty sure this is not related.

I’m checking on my end to see if I can spot any issue during your push, but since you saw √ Branch 4641-fix-lat-long-override-bug successfully pushed onto Test., everything should work as expected.

I’ll get back to you if I can spot anything.

1 Like

@jeffladiray Thanks!

Would it be possible for you to share here the last 4 digits of the FOREST_ENV_SECRET associated with the development environment you used to push?

On my end, I can see that the branch branch 4641-fix-lat-long-override-bug is closed, and I can’t spot any failing update :confused:

Could you also (If possible ofc), share here one of the layout modification you made on this branch that is not visible on the Test environment?

Thanks in advance :pray:

1 Like

The last 4 digits of my Development environment SECRET (the source of the push): e9d8

The last 4 digits of the Test environment SECRET (the target of the push): fc8f

I did not make a “layout” change, but I did change the code being executed for a Smart Action (“import data”). The route for this Action is:

router.post('/projects/actions/import-data'

The route code eventually calls createObjectFromRow. The modified code is for setting latitude and longitude (keeping the current record’s value if the import value is null/blank).

function createObjectFromRow(row, projectData) {
  return {
    imei: trim(row[0]).padStart(15, '0'),
    qrCode: isEmpty(row[1]) ? projectData?.qrCode : trim(row[1]).padStart(6, '0'),
    model: trim(row[2]),
    projectId: trim(row[3]),
    partnerId: trim(row[4]),
    partnerIdName: trim(row[5]),
    country: trim(row[6]),
    administrativeUnit1: trim(row[7]),
    administrativeUnit2: trim(row[8]),
    administrativeUnit3: trim(row[9]),
    administrativeUnit4: trim(row[10]),
    communityName: trim(row[11]),
    alternateCommunityName: trim(row[12]),
    serviceProvider: trim(row[13]),
    systemName: trim(row[14]),
    waterPointName: trim(row[15]),
    latitude: isEmpty(row[16]) ? projectData?.latitude : row[16],
    longitude: isEmpty(row[17]) ? projectData?.longitude : row[17],
    uniqueDailyWaterUsers: isEmpty(row[18]) ? null : row[18],
    locationType: trim(row[19]),
    installationDate: isEmpty(row[20]) ? null : new Date(parseDate(row[20])),
  }
}

The behavior that I’m still seeing in the Test environment is that when uploading blank latitude and longitude values, the database column is updated with null instead of keeping the previous value. This code is working as expected in the Development environment.

That explains a lot :sweat_smile: (I was looking to find layout changes on my end but wasn’t able to spot anything)

forest push will only deploy layout changes from one environment to another, and not your code.
Can you confirm that both the code change was deployed to your Test, environment, and that the server/nodejs associated with that environment has restarted after the deployment?

Thanks in advance :pray:

1 Like

I have very little experience with Forest Admin, so please excuse my ignorance. I don’t know where to look at the code specifically in the Test environment, and I don’t know how to restart a Forest Admin environment. I’m not seeing anything about restarting environments when I search the documentation.

Since I’m not making layout changes, perhaps I’m misunderstanding the deployment process.

No issue at all, let me sum up the “classical” development workflow.

We distinguish 2 types of the deployment:

  1. The one related to your admin backend code (Smart action, routes override, etc)
    • Nothing for this is handled by forest admin. The code contained by your agent is stored/deployed on your end and on your architecture (AWS/Heroku/GCP/etc).
  2. The one related to your layout configuration (Showing/Hiding collections/fields, etc)
    • This is what forest branch/push/deploy handles, and it only concern changes of layout made on app.forestadmin.com. No change of layout mean no need to branch/push/deploy.

We have a few pieces of documentation that talks about our development workflow here and here if that may help

(Let me know if things are still unclear :slight_smile: )

1 Like

That’s both clear and unclear. :slight_smile:

As far as I know, this particular code base isn’t running anywhere in AWS (our database backend). It’s in GitHub, and it handles the various routes for our Forest Admin environments. But from what you’ve said, it sounds like that code actually needs to be deployed to an AWS EC2 instance. Is that correct?

If so, is there a way in Forest Admin for me to find where our environments are calling those route endpoints. Our previous developer didn’t leave any documentation, so I don’t have a good way of discovering where that code/environment server is supposed to be running.

Thanks!

If so, is there a way in Forest Admin for me to find where our environments are calling those route endpoints. Our previous developer didn’t leave any documentation, so I don’t have a good way of discovering where that code/environment server is supposed to be running.

You should be able to see such informations in your project settings, on the “Environments” tabs. All your environments should be listed there, with their associated endpoint. That will not help you to locate where they are deploy, but having the domain name contacted by the frontend should definitely help.

As far as I know, this particular code base isn’t running anywhere in AWS (our database backend). It’s in GitHub, and it handles the various routes for our Forest Admin environments. But from what you’ve said, it sounds like that code actually needs to be deployed to an AWS EC2 instance. Is that correct?
AWS EC2 should work indeed. The idea is that you are the complete owner of the admin backend code, so it can be deploy anywhere you would like

1 Like

Thanks, @jeffladiray! This helps me a lot in understanding the architecture. Now begins the investigations on my end. :slight_smile:

1 Like

No problem. I’ll mark the thread as resolved since I’m pretty sure the initial issue will solve by itself once the code is deployed.

If you encounter any other issue, feel free to open a new thread, the team will be more than happy to assist if you need further help :slight_smile:

Have a nice day!

1 Like