-
Notifications
You must be signed in to change notification settings - Fork 37
Client gets null pointer exception when connection tag is disabled #256
Comments
By the time that PR was made, when the connection tag was disabled it returned a valid req with 400 code, it might have changed now. |
The weird part is why the error callback is getting no arguments (from what my client is seeing). I'm not sure if that's correct/expected behavior or not. Regardless, if there's a check for |
IMHO if we have a scenario where the req can be null and cause the "null pointer exception” we should validate it c/c @jcesarmobile |
We should know first if the null req is because it's disabled or because of another reason. So, if req null because of another reason it should be
If req is null because it's disabled, then all the code could be simplified as we don't have to check for the 400 error anymore |
@jcesarmobile make sense 👍 |
@jcesarmobile could you made a PR for this fix, please? |
I can make it, but I have no way of testing if it works fine as I no longer have access to any studio |
@jcesarmobile the JIRA for it is: https://issues.jboss.org/browse/RHMAP-19268 |
I still haven't heard anyone state why just adding a null check here is actually the correct solution. As my debugging screenshot shows, all args passed to the error handler are undefined in this case. Surely that's not expected behavior? |
@camilamacedo86 I no longer work at Red Hat, so I have no access to any RHMAP studio instance to test if disabled connections are returning a null req now instead of returning a req with a error code 400. |
@jcesarmobile sorry. I didn't realize that. Tks for all your support here. |
@camilamacedo86 I just spoke with the client dev about reproducing it, and it looks like the null pointer is only thrown when running the app on our local browser. When run on an iPhone, disabling the connection tag acts like it should. I don't have a clue why, but the app/init call results in the error handler getting called with all null args in desktop Chrome. So probably not something we should be terribly concerned with. Anyways, while it will work against a production build, testing it locally is still a bit of an issue for us. We think it's a CORS issue trying to do the app/init call on app startup. Do you have any recommendations for doing this from Chrome or Safari on the desktop? (Also, adding those null checks in the handler are still probably a good idea 👍 ) |
@MikeyBurkman @camilamacedo86 might be worth looking into why the JSONP fallback (shouldd be used in browser) is not returning a response consistent with the endpoint the mobile device hits. Sounds like that might be the root cause? |
@MikeyBurkman shows that the scenario where the req can be null/undefined is exactly my guess shared with you in the slack when you raised it. The client app is running in a local environment and it is not setup/configurated to do the request for the cloud app deployed in RHMAP. The solution is to configure the local environment to call the cloud application deployed into RHMAP or use a new version of SDK when the PR #257 be merged. IHMO the root cause anyway is the code implementation is not covering this scenario which will be solved with the PR #257. c/c @davidffrench let's do the merge? Could you check it? |
We always knew the req was null from the beginning. The screenshot demonstrates that clearly. We just didn't know why it was null. And to be honest, we still don't. |
I agree with @MikeyBurkman , the null checks in the handler are required no matter what, so the PR should be merged. @evanshortiss I reckon you are correct, it must be an issue or inconsistency with the JSONP fallback. |
According to [~mburkman] this issue just occurs when the client application is running locally and [~evanshortiss] believe that it can have some relation to and you agreed either that it must be an issue or inconsistency with the JSONP fallback. My guess is that the client app is not set up to use the cloud app deployed on RHMAP. So, could we close this issue as the PR is merged or is required here some further action? |
This is related to this PR: #213
When the connection tag is disabled, all the parameters passed to the
error
callback, includingreq
, are apparently undefined. That PR assumes thatreq
is defined, even though there's an explicit check forreq
not being there a couple lines above it. Line 86 in initializer.js thus throws a null pointer instead of calling the callback with the appropriate error.https://github.com/feedhenry/fh-js-sdk/blob/2.23.0/src/modules/initializer.js#L86
The text was updated successfully, but these errors were encountered: