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

fix: move port validation and waiting logic into proxy server #182

Merged
merged 2 commits into from Apr 13, 2021

Conversation

anthonychu
Copy link
Member

Move wait for port logic into the proxy.

  • Running swa start http://localhost:3000 --run "npm:start" --app-location frontend now works properly
  • Moving the wait for API to just before starting the proxy means most of the function app output now prints before the proxy starts. This ensures that this message will no longer be hidden by the function app output:
    [swa] Available on:
    [swa]     http://192.168.187.166:4280
    [swa]     http://0.0.0.0:4280
    [swa] 
    [swa] Azure Static Web Apps emulator started. Press CTRL+C to exit.
    

@github-actions github-actions bot added the scope: msha Issues happened a the ./src/msha level label Apr 11, 2021
Comment on lines +331 to +332
const isApi = Boolean(SWA_CLI_API_LOCATION && SWA_CLI_API_URI);
if (isApi) {
Copy link
Member

Choose a reason for hiding this comment

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

There is already a global flag called isApiDevServer:

Suggested change
const isApi = Boolean(SWA_CLI_API_LOCATION && SWA_CLI_API_URI);
if (isApi) {
if (isApiDevServer) {

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to wait whether it’s using dev server or if someone passed a path to the API folder, so that the output from func is printed before the proxy starts.

src/proxy/server.ts Outdated Show resolved Hide resolved
@manekinekko
Copy link
Member

LGTM.

@anthonychu anthonychu merged commit 4674b70 into main Apr 13, 2021
@anthonychu anthonychu deleted the anthonychu/fix-startup-wait branch April 13, 2021 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: msha Issues happened a the ./src/msha level
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants