Install and configure React on IBMi server

I have been trying to install and run React sample app (https://noderun.com/alex/react.js-rich-display/) on our IBMi Profoundjs environment. I have downloaded zip file and added to our IBMi server under /profoundjs/modules/ folder, added to config file and re-started the server. I followed instruction according to this document (https://docs.profoundlogic.com/display/PUI/Running+NodeRun+Workspaces+in+Profound.js). However, it runs and ends session immediately. It’s not showing anything. Any idea?

Thanks in advance.

Hello Saidur,

Do you notice any error messages in the browser’s dev tools, or in the Profound.js server logs? You can find information on the Profound.js server logs here: https://docs.profoundlogic.com/x/HIXrAQ.

You mentioned that the session ends immediately, and that you do not see anything, I wanted to ask for exactly what you do see when you run the application? Do you see the end of session screen? Or a blank white screen?

The more information you can provide on the issue the better we will be able to assist you!

Thanks,

Kyle Law
Technical Support Specialist
Profound Logic Software

Hi Kyle,
I see this screen immediately after I run the program:
pjs_session_screen

Here is the log:

2020-03-30 14:08:43 | Session DEF269592DCE7D303ADFEB798A1B7C2AEB2C7851B0D75CBD4C9A93979F86BD4F | User username
{ Profound.js Error: Decimal data error.
at Object.toBin (/profoundjs/node_modules/profoundjs/data-types/packed.jse:32:13)
at Object.set (/profoundjs/node_modules/profoundjs/api/define.jse:923:20)
at initialize (/profoundjs/node_modules/profoundjs/api/define.jse:1104:27)
at Object.profound.define (/profoundjs/node_modules/profoundjs/api/define.jse:1039:3)
at Object.keys.forEach.fieldName (/profoundjs/node_modules/profoundjs/ui/Display.jse:2139:16)
at Array.forEach ()
at initializeFields (/profoundjs/node_modules/profoundjs/ui/Display.jse:2106:26)
at profound.ui.RecordFormat.init (/profoundjs/node_modules/profoundjs/ui/Display.jse:1052:5)
at initialize (/profoundjs/node_modules/profoundjs/ui/Display.jse:299:14)
at new profound.ui.Display (/profoundjs/node_modules/profoundjs/ui/Display.jse:307:3)
statusCode: 907,
name: ‘Profound.js Error’,
appJob: null,
currUser: null,
clientIp: null,
clientPort: null }

Let me know if you need anything else.

Thanks.

Hello Saidur,

It looks like you may not have the application configured correctly. You mentioned that you added to the server’s config.js file. Could you tell us what you added, as well as the URL you are using to call the application from the browser?

As a test, I downloaded the zip file from the workspace you mentioned in your original post and installed a test instance of Profound.js to try and get this working myself, and I was able to set up a working example with only a few steps.

First I manually copied the app directory from the zip file’s modules directory, into my test Profound.js server’s modules directory:

Then I started the server and navigated to [hostname]:[port]/app/ (I tested on a local PC instance so for me this was localhost:8081/app/ ):

As you can see the app does show up correctly, albeit with no information because I did not set up a database connection.

From what you are describing it sounds like you have it configured to try and run the application as a Profound.js session by calling a JavaScript file as the entry point. However, react applications work differently when compared to Profound.js sessions, as the entry point should instead by an HTML file that then calls different web services to retrieve the data as needed.

Thanks,

Kyle Law
Technical Support Specialist
Profound Logic Software

1 Like

Hi Kyle,
I followed your instruction and installed the app again and it worked this time. It seems to me that error came from adding route to Profoundjs config file. I was calling the HTML file as the entry point. When I took that route from config file, it started to work. Learn something new everyday :slight_smile:

Thanks for you help, Kyle!

1 Like

Another question. I’m developing an app based on this example: React sample app (https://noderun.com/alex/react.js-rich-display/)) on our IBMi Profoundjs environment. I have new problem now. It’s giving me this following error:

TypeError: Cannot read property ‘0’ of null
at Object.getCustomer (/profoundjs/modules/react-app/getCustomer.js:4:177)
at Object.profound.call (/profoundjs/node_modules/profoundjs/api/call.jse:169:25)
at /profoundjs/node_modules/profoundjs/api/express.jse:26:18

Request URL:
http://server/react-app/getCustomer?cucode=AAAAM

It seems like, server cannot find it. Any idea?

Any help would be very much appreciated.

Thanks.

Hello Saidur,

It looks like there might be a syntax error in your getCustomer.js file. If you can email the source code to support@profoundlogic.com we can look into further. As a reminder, please rename the file to a .txt file so that it does not get blocked by email filters.

Thanks,

Kyle Law
Technical Support Specialist
Profound Logic Software