SOLVED Data from app manager NodeJS API different from Port Call

pharmHalo

Member
Oct 19, 2021
10
3
3
australia
cPanel Access Level
Root Administrator
Apologies on the naming of the Title.

I have a working API which i was running on port 3000.

I have copied this api folder and am running it under app manager .

lets say i create a record using the App Manager (call it PROD) version.

This is created and sent via API to the DB.
DB is correct.

Issue is, if i look for the record through the api.. it isnt there!

If i do all this via the port 3000 api... it works!

It's like the app manager API is using a snapshot fo the database instead of using fresh data...

Is this even possible??


Below is an example:

Code:
https://www.myAPI.com.au:3000/prod/orders/myOrders/1709
JSON:
{
    "Result": true,
    "order": {
        "orderID": 1709,
        "chemOrderID": 1243,
        "firstName": "test",
        "lastName": "test",
        "phone": "04123456",
        "email": null,
        "prefContact": 1,
        "itemName": "KN95 Box Of 30 ",
        "itemQuantity": 1,
        "plu": null,
        "modelNumber": null,
        "colour": null,
        "itemDetails": null,
        "supplier": "avacare",
        "itemSize": null,
        "amountPaid": 0,
        "receiptNumber": "00",
        "quotedPrice": 69.99,
        "orderComments": null,
        "reorder": 0,
        "isNDIS": 0,
        "isNDISPaid": 0,
        "onHold": 0,
        "requestedBy": 35,
        "orderedBy": 35,
        "receivedBy": 35,
        "finalisedBy": 0,
        "overdueBy": 0,
        "NDISBy": 0,
        "deletedBy": 0,
        "requestedByName": "Jac",
        "orderedByName": "Jac",
        "receivedByName": "Jac",
        "finalisedByName": null,
        "overdueByName": null,
        "deletedByName": null,
        "requestedDateShort": "18 Jan",
        "orderedDateShort": "18 Jan",
        "receivedDateShort": "18 Jan",
        "finalisedDateShort": null,
        "overdueDateShort": null,
        "deletedDateShort": null,
        "requestedDate": "2022-01-18T09:40:21",
        "orderedDate": "2022-01-18T09:50:33",
        "receivedDate": "2022-01-18T12:21:41",
        "finalisedDate": null,
        "overdueDate": null,
        "deletedDate": null,
        "etaMaxDateShort": "Thu, 20 Jan",
        "etaCode": 2,
        "locationID": 199,
        "supplierRef": null,
        "locationOther": null,
        "categoryID": 5,
        "categoryName": "GENERAL SHOP"
    }
}

Code:
https://www.myAPI.com.au/prod/orders/myOrders/1709
JSON:
{
    "Result": true,
    "order": {
        "orderID": 1709,
        "chemOrderID": 1243,
        "firstName": "test",
        "lastName": "test",
        "phone": "04123456",
        "email": null,
        "prefContact": 1,
        "itemName": "KN95 Box Of 30 ",
        "itemQuantity": 1,
        "plu": null,
        "modelNumber": null,
        "colour": null,
        "itemDetails": null,
        "supplier": "avacare",
        "itemSize": null,
        "amountPaid": 0,
        "receiptNumber": "00",
        "quotedPrice": 69.99,
        "orderComments": null,
        "reorder": 0,
        "isNDIS": 0,
        "isNDISPaid": 0,
        "onHold": 0,
        "requestedBy": 35,
        "orderedBy": 35,
        "receivedBy": 0,
        "finalisedBy": 0,
        "overdueBy": 0,
        "NDISBy": 0,
        "deletedBy": 0,
        "requestedByName": "Jac",
        "orderedByName": "Jac",
        "receivedByName": null,
        "finalisedByName": null,
        "overdueByName": null,
        "deletedByName": null,
        "requestedDateShort": "18 Jan",
        "orderedDateShort": "18 Jan",
        "receivedDateShort": null,
        "finalisedDateShort": null,
        "overdueDateShort": null,
        "deletedDateShort": null,
        "requestedDate": "2022-01-18T09:40:21",
        "orderedDate": "2022-01-18T09:50:33",
        "receivedDate": null,
        "finalisedDate": null,
        "overdueDate": null,
        "deletedDate": null,
        "etaMaxDateShort": "Thu, 20 Jan",
        "etaCode": 2,
        "locationID": null,
        "supplierRef": null,
        "locationOther": null,
        "categoryID": 5,
        "categoryName": "GENERAL SHOP"
    }
}

If you notice for example "locationID" near the bottom.
If i make the call using the PORT then this returns a result.
If I make the call using the API via app manager there is no location ID!!

This is the same database, same data, same record and calls run within 30 seconds of each other.

I have no idea what is going on here but I'm sure it relates to the App Manager as I hve been using the port fo 5 months of testing and this happens the day I have started switching clients to the App Manager URL for calls.
 

pharmHalo

Member
Oct 19, 2021
10
3
3
australia
cPanel Access Level
Root Administrator
More Testing results:
So I created 2 'port' nodes
and 2 app manager controlled nodes.

Eg. I'm running 4 nodes, all using the same original copied folder
Thus same DB access, same user, same data everything.

All running:
- I ran a call to get some record data (record 1716)
- All gave the same response
- I then manually altered some data in the record using mysql workbench, thus ensuring the data was changed straight in the DB.
- I than ran the SAME call as first step on each api.

....

Results:
- Both Port nodes updated and correct
- both app manager API nodes still had the same data before my change!


I then went to app manager and disabled the nodes and reenabled./

Ran the call on the same two nodes and the data was correct...

So its like they have the data from the db and just sit there and thats it. It's like the app manager nodes are looking at a snapshot of the DB from when they wre booted???
 

pharmHalo

Member
Oct 19, 2021
10
3
3
australia
cPanel Access Level
Root Administrator
Hi Anthony,
So I have figured it out (I believe). The issue is the ngnix cache. The cache is receiving a request and caching it, then when asked again it uses that same data instead of using new data from the DB..
I have turned off the cache and this has fixed the issue.
 
  • Like
Reactions: cPanelAnthony