-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Staging API] To Use Staging Server or not to use staging server #15517
Conversation
@neil-marcellini @sobitneupane One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshots/Videos
Web
Screen.Recording.2023-02-28.at.17.01.51.mov
Mobile Web - Chrome
Screen.Recording.2023-02-28.at.17.17.44.mov
Mobile Web - Safari
Screen.Recording.2023-02-28.at.17.13.32.mov
Desktop
Screen.Recording.2023-02-28.at.17.08.43.mov
iOS
Screen.Recording.2023-02-28.at.17.24.10.mov
Android
Screen.Recording.2023-02-28.at.17.29.56.mov
@Prince-Mendiratta Can you please add screenshots for the condition ".env is defined" in Tests? |
@sobitneupane Sure, will do so. Is it required for all platforms? |
@Prince-Mendiratta I think so. Web and Native behave differently. So, it is good to have screenshots for all platforms. |
Got it, I'll ping you once I've added the recordings. |
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
@sobitneupane updated with tests! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The code tests well and it's looking pretty good. I would like to see a few tweaks to make the code a bit easier to understand.
Also, I don't think we want to ask people to add a bank account with Plaid on production for testing. I think it should be enough to see that Plaid links to the production environment. Adding a bank account in the sandbox is a good idea however. I'm curious, what credentials do you use to test in the Sandbox mode?
cc @iwiznia @mountiny in case you guys want to take a look since you participated in the Slack conversation. |
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
.env.staging file has the following content:
We are expecting to have
cc: @neil-marcellini |
@sobitneupane As far as I understand, the As for the staging and secure staging URL, even if they are not defined in the staging Lines 16 to 17 in 44c19cb
We only need to set the
|
@Prince-Mendiratta Thanks. I was just looking for confirmation from CME. |
username: user_good |
Oof, I think we now how 3 PRs touching a similar code #14944 and #15178 cc @kidroca @MonilBhavsar would you want to review this one too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some notes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really close to being ready. I agree with @kidroca's comment about moving the api map constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed with kidroca comment, had one other question
@neil-marcellini I tried to generate a production build for web and used Also, is it required to test the production build for all platforms? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, although always anxious about these changes, gotta make sure to test everything really well after deploy (shouldnt be an issue, but we had in past let regressions slip because we did not test properly and it was not easy to spot)
I tested the production builds for android, iOS, desktop and it works well. Since the staging toggle is not visible, it doesn't affect the functionality and does not break anything. I tried out the staging build too for the above platforms and it was working well as expected including the tests mentioned above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some notes on the regex usage
I lean towards NAB, but perhaps it would be simpler if we don't use regex
Signed-off-by: Prince Mendiratta <prince.mendi@gmail.com>
7323183
gentle bump @neil-marcellini |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Prince-Mendiratta @kidroca I will go ahead and merge this since @neil-marcellini already gave his approval before.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@mountiny can you please tell the issue? Is it because of the requests not hitting the .dev domain? |
@Prince-Mendiratta correct, for internal engineers, the requests should be hitting local dev VM, this is my env:
|
@mountiny You'll have to modify the .env slightly to include this case too:
Can you please try with these and see if the issue is resolved? Thanks. |
My analysis based on the limited information from the above screenshot, looks like the local storage has the As per a summary of the slack discussion, we should send in a disclaimer for internal employees to update their .env files to reflect the changes with this PR. |
no user key in the onyx so that wont be the issue
@Prince-Mendiratta Can we achieve this without everyone needing to change their local env? |
I see, I wonder why the app is hitting the staging API then. 🤔
@mountiny as we discussed in the slack thread that the easiest way to implement this would be to let the .env determine which endpoint to hit, do we want to revisit that decision? |
@Prince-Mendiratta it does not work even with the updated env. In a call now, can you please create a thread in Slack to discuss this/test this easier :) thanks 🙇 |
|
||
// Desktop and web use staging config too so we we should default to staging API endpoint if on those platforms | ||
const shouldDefaultToStaging = _.contains([CONST.PLATFORM.WEB, CONST.PLATFORM.DESKTOP], getPlatform()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the reason you're hitting staging @mountiny
The default should always be false now be false
unless we're on staging
🚀 Deployed to staging by https://github.com/mountiny in version: 1.2.79-0 🚀
|
Has this PR been reverted? Can we check it off? #15678 |
@mvtglobally yes it was reverted here #15678 |
🚀 Deployed to production by https://github.com/roryabraham in version: 1.2.79-0 🚀
|
Details
With this PR, we are adding the ability to map all requests to production / staging API depending on the "Use staging server" toggle in user preferences. This change only affects the Development and Staging Environment.
Fixed Issues
$ #12315
PROPOSAL: #12315 (comment)
Tests
.env is not defined
Use staging server
toggle ON.Use staging server
toggle OFF.Expected Console Output
.env is defined
This is basically to confirm that all the requests will be proxied to the server depending on the contents of the .env file. To test this, create a .env file with this content:
Use staging server
toggle ON.Use staging server
toggle OFF.Expected Console Output
Note: There is a known issue in Android where when repeating the above tests will lead to an error. This has been reported in slack and will be tackled in a separate issue. The above tests should work well for all other platforms.
Note 2: You might see an "Internal React error: Attempted to capture" error while testing but that is being tackled in #13917 and is not related to current changes.
Offline tests
N/A, doesn't affect the offline functionality, should behave the same as expected behaviour when offline.
QA Steps
This doesn't affect the production behaviour. For staging,
Use staging server
toggle ON.Use staging server
toggle OFF.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)ScrollView
component to make it scrollable when more elements are added to the page.Screenshots/Videos
without .env defined
Web
2023-02-28.02-13-17.mp4
Mobile Web - Chrome
2023-02-28.02-37-30.mp4
Mobile Web - Safari
mWeb-Safari.mp4
Desktop
desktop.mp4
iOS
2023-02-28.02-06-56.mp4
Android
2023-02-28.02-35-08.mp4
.env defined as mentioned in above tests
Web
2023-02-28.18-05-34.mp4
Mobile Web - Chrome
2023-02-28.18-13-08.mp4
Mobile Web - Safari
2023-02-28.20-48-37.mp4
Desktop
2023-02-28.20-42-09.mp4
iOS
2023-02-28-20-32-23_3RJY0UXT.mp4
Android
2023-02-28.18-14-36.mp4