Skip to content
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

Add https to webpack dev server #28422

Merged
merged 19 commits into from
Oct 30, 2023
Merged

Add https to webpack dev server #28422

merged 19 commits into from
Oct 30, 2023

Conversation

justinpersaud
Copy link
Contributor

@justinpersaud justinpersaud commented Sep 29, 2023

Enables https on webpack dev server

Details

Enables https for local development

Before merging, we need to send out communication to #expensify-open-source and let them know as this will break their local devs until they setup the certificates.

After this PR is merged, merge this PR.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/320857

$
PROPOSAL:

Tests

  • Verify that no errors appear in the JS console

Offline tests

QA Steps

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
    • MacOS / Desktop
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
      • If any non-english text was added/modified, I verified the translation was requested/reviewed in #expensify-open-source and it was approved by an internal Expensify engineer. Link to Slack message:
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is approved by marketing by adding the Waiting for Copy label for a copy review on the original GH to get the correct copy.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android

@justinpersaud justinpersaud self-assigned this Sep 29, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

npm has a package.json file and a package-lock.json file. It seems you updated one without the other, which is usually a sign of a mistake. If you are updating a package make sure that you update the version in package.json then run npm install

@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

Hey, I noticed you changed some webpack configuration files. This can break production builds. Did you remember to run a production build locally to verify they still work?

@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

npm has a package.json file and a package-lock.json file. It seems you updated one without the other, which is usually a sign of a mistake. If you are updating a package make sure that you update the version in package.json then run npm install

@justinpersaud justinpersaud changed the title Add https to webpack dev server [HOLD announcement to #expensify-open-source] Add https to webpack dev server Sep 29, 2023
@justinpersaud justinpersaud marked this pull request as ready for review September 29, 2023 04:21
@justinpersaud justinpersaud requested a review from a team as a code owner September 29, 2023 04:21
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

npm has a package.json file and a package-lock.json file. It seems you updated one without the other, which is usually a sign of a mistake. If you are updating a package make sure that you update the version in package.json then run npm install

@melvin-bot melvin-bot bot requested review from rushatgabhane and removed request for a team September 29, 2023 04:21
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

@rushatgabhane Please 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]

@justinpersaud justinpersaud requested review from hayata-suenaga and a team and removed request for rushatgabhane September 29, 2023 04:21
@melvin-bot melvin-bot bot requested review from Ollyws and removed request for a team September 29, 2023 04:21
@melvin-bot
Copy link

melvin-bot bot commented Sep 29, 2023

@Ollyws @ 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]

package.json Outdated Show resolved Hide resolved
@hayata-suenaga
Copy link
Contributor

I tested. I messaged you on slack

@hayata-suenaga
Copy link
Contributor

@justinpersaud on web, this tested well

However, the desktop build isn't working. I'll test more and provide more details.

We also need to edit the CSP of dev OldDot here. I can make a PR for this one tomorrow morning

@justinpersaud
Copy link
Contributor Author

Ok, let me know when you're satisfied with this then and I'll remove hold and do the announcement to contributors.

@hayata-suenaga
Copy link
Contributor

However, the desktop build isn't working. I'll test more and provide more details.

This is blocking. @justinpersaud did your desktop build worked?

We also need to edit the CSP of dev OldDot here. I can make a PR for this one tomorrow morning

This is not blocking

I gonna sleep now but I'll come back to this tomorrow morning

@rushatgabhane
Copy link
Member

rushatgabhane commented Oct 2, 2023

the desktop build isn't working

electron: Failed to load URL: http://localhost:8082/ with error: ERR_EMPTY_RESPONSE

image

@melvin-bot melvin-bot bot requested a review from cristipaval October 27, 2023 17:30
@melvin-bot
Copy link

melvin-bot bot commented Oct 27, 2023

@cristipaval Please 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]

@Expensify Expensify deleted a comment from rushatgabhane Oct 27, 2023
hayata-suenaga
hayata-suenaga previously approved these changes Oct 27, 2023
Copy link
Contributor

@hayata-suenaga hayata-suenaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinpersaud the PR is ready to be merged, would it be possible for you to post the announcement to the open source channel

Copy link
Contributor

@thienlnam thienlnam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to do anything for adhoc builds as well?

@justinpersaud justinpersaud changed the title [HOLD Money2020 and announcement to #expensify-open-source] Add https to webpack dev server [HOLDannouncement to #expensify-open-source] Add https to webpack dev server Oct 27, 2023
@justinpersaud
Copy link
Contributor Author

Long thread here https://expensify.slack.com/archives/C03TQ48KC/p1698343291525409

But we are changing the hostname to dev.new.expensify.com so just pushed that change.

@akinwale
Copy link
Contributor

akinwale commented Oct 28, 2023

Retested with dev.new.expensify.com as the URL.

Works well.

cc @hayata-suenaga

@hayata-suenaga
Copy link
Contributor

@justinpersaud Please see this Slack message

@hayata-suenaga
Copy link
Contributor

hayata-suenaga commented Oct 28, 2023

@thienlnam

Do we need to do anything for adhoc builds as well?

This PR changes the URL used by the local NewDot dev server. This doesn't affect Ad Hoc builds.

We currently don't have a good solution to test Hybrid Web on Ad Hoc builds. Ad Hoc builds will keep working for Chat functionalities. On Ad Hoc builds, you will just see a blank space for the portion where the iframe is supposed to occupy.

Copy link
Contributor

@hayata-suenaga hayata-suenaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akinwale confirmed that the PR works with dev.new.expensify.com

@justinpersaud

could you post a message to the #expensify-open-source channel and send an email to the engineering team about the upcoming changes?

and then we can merge the PR

@justinpersaud justinpersaud changed the title [HOLDannouncement to #expensify-open-source] Add https to webpack dev server Add https to webpack dev server Oct 30, 2023
@justinpersaud justinpersaud merged commit 9443ece into main Oct 30, 2023
20 checks passed
@justinpersaud justinpersaud deleted the jpersaud_ssl branch October 30, 2023 17:16
@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@erquhart
Copy link
Contributor

erquhart commented Oct 30, 2023

Update: Check out the changes to readme if you're running into this: https://github.com/Expensify/App/pull/28422/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5


This PR broke local dev for me:

[web-proxy] 
[web-proxy] > new.expensify@1.3.74-3 web-proxy
[web-proxy] > node web/proxy.js
[web-proxy] 
[web-server] 
[web-server] > new.expensify@1.3.74-3 web-server
[web-server] > webpack-dev-server --open --config config/webpack/webpack.dev.js
[web-server] 
[web-proxy] Creating proxy with host: www.expensify.com for production API and staging.expensify.com for staging API
[web-proxy] Proxy server listening at http://localhost:9000
[web-server] <i> [webpack-dev-server] [HPM] Proxy created: /api  -> http://[::1]:9000
[web-server] <i> [webpack-dev-server] [HPM] Proxy created: /staging  -> http://[::1]:9000
[web-server] <i> [webpack-dev-server] [HPM] Proxy created: /chat-attachments  -> http://[::1]:9000
[web-server] <i> [webpack-dev-server] [HPM] Proxy created: /receipts  -> http://[::1]:9000
[web-server] [webpack-cli] Error: error:0909006C:PEM routines:get_name:no start line
[web-server]     at node:internal/tls/secure-context:65:13
[web-server]     at Array.forEach (<anonymous>)
[web-server]     at setCerts (node:internal/tls/secure-context:63:3)
[web-server]     at configSecureContext (node:internal/tls/secure-context:152:5)
[web-server]     at Object.createSecureContext (node:_tls_common:117:3)
[web-server]     at Server.setSecureContext (node:_tls_wrap:1346:27)
[web-server]     at Server (node:_tls_wrap:1205:8)
[web-server]     at new Server (node:https:69:3)
[web-server]     at Object.createServer (node:https:105:10)
[web-server]     at Server.createServer (/<repo-root-redacted>/node_modules/webpack-dev-server/lib/Server.js:2447:57)
[web-server]     at Server.initialize (/<repo-root-redacted>/node_modules/webpack-dev-server/lib/Server.js:1820:10)
[web-server]     at Server.start (/<repo-root-redacted>/node_modules/webpack-dev-server/lib/Server.js:3253:16)
[web-server]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
[web-server]     at async Command.<anonymous> (/<repo-root-redacted>/node_modules/@webpack-cli/serve/lib/index.js:257:25)
[web-server]     at async Promise.all (index 1)
[web-server]     at async Command.<anonymous> (/<repo-root-redacted>/node_modules/webpack-cli/lib/webpack-cli.js:1372:13) {
[web-server]   library: 'PEM routines',
[web-server]   function: 'get_name',
[web-server]   reason: 'no start line',
[web-server]   code: 'ERR_OSSL_PEM_NO_START_LINE'
[web-server] }
[web-server] npm run web-server exited with code 2
^C[web-proxy] npm run web-proxy exited with code SIGINT

@thienlnam
Copy link
Contributor

@erquhart
Copy link
Contributor

I did, found that and added a note to the top of my comment for others a bit ago. Thank you!

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by https://github.com/justinpersaud in version: 1.3.94-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

1 similar comment
@OSBotify
Copy link
Contributor

OSBotify commented Nov 1, 2023

🚀 Deployed to staging by https://github.com/justinpersaud in version: 1.3.94-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Nov 2, 2023

🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.94-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Nov 2, 2023

🚀 Deployed to staging by https://github.com/justinpersaud in version: 1.3.95-0 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify
Copy link
Contributor

OSBotify commented Nov 6, 2023

🚀 Deployed to production by https://github.com/puneetlath in version: 1.3.95-9 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@MichaelBuhler MichaelBuhler mentioned this pull request Jan 16, 2024
50 tasks
MichaelBuhler added a commit to MichaelBuhler/expensify that referenced this pull request Jan 16, 2024
This was missed in commit ed9707a on Expensify#28422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.