question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

swa start says --api option unknown, yet requires it

See original GitHub issue

Before filing this issue, please ensure you’re using the latest CLI by running swa --version and comparing to the latest version on npm.

Are you accessing the CLI from the default port :4280 ?

  • No, I am using a different port number (–port) and accessing the CLI from that port
  • Yes, I am accessing the CLI from port :4280

Make sure you are accessing the URL printed in the console when running!

Describe the bug –api option is an unknown option, yet required

To Reproduce Steps to reproduce the behavior:

  1. Go to ‘
  2. Type in command ‘swa start www’
  3. watch error ask for ‘Please use the --api option’
  4. Type in command ‘swa start www --api .’
  5. See error ‘error: unknown option ‘–api’’

Expected behavior I want to add --api option but it is not recognised, but the warning insists I add is (see code block). I am following AnthonyChu’s youtube https://www.youtube.com/watch?v=MF-nvoTUouk&t=2510 and the command is legit (I believe)

Screenshots

~/Projects/AnthonyChuDemo(master|…) % swa start www      
[swa] 
[swa] Serving static content:
[swa]     /Users/c0b0dpd/Projects/AnthonyChuDemo/www
[swa] 
[swa] 
[swa] This CLI is currently in preview and runs an emulator that may not match the 
[swa] cloud environment exactly. Always deploy and test your app in Azure.
[swa] 
[swa] 
[swa] Azure Static Web Apps emulator started at http://localhost:4280. Press CTRL+C to exit.
[swa] 
[swa] 
[swa] ***************************************************************************
[swa] ** Functions request detected but no endpoint configuration was found.   **
[swa] ** Please use the --api option to configure a function endpoint.         **
[swa] ***************************************************************************
[swa] POST http://localhost:7071/api/negotiate?negotiateVersion=1 (proxy)
[swa]  ↳ POST http://localhost:7071/api/negotiate?negotiateVersion=1 - 502 (Bad Gateway)
^C[swa] node "/Users/c0b0dpd/.nvm/versions/node/v16.13.0/lib/node_modules/@azure/static-web-apps-cli/dist/msha/server.js" exited with code 0
~/Projects/AnthonyChuDemo(master|…) % swa start www --api .                                  
error: unknown option '--api'

Desktop (please complete the following information):

  • OS: macOS[e.g. iOS]
  • Browser firefox[e.g. chrome, safari]
  • Version 0.8.2 [e.g. 22]

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
anthonychucommented, Feb 22, 2022

It’s been changed to --api-location but that error message is outdated. We’ll get it updated. Sorry about that! https://github.com/Azure/static-web-apps-cli/blob/0ea71464a703003c6e6b239e59a124b1cb328211/src/msha/handlers/function.handler.ts#L58

0reactions
sgollapudi77commented, Feb 23, 2022

Hey @williamheelis , please check this issue #335 I think you’re encountering a similar error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proxy can't connect to Functions CLI v4 · Issue #335 - GitHub
But when I go to localhost:7071 I can see the "Your Functions 4.0 app is up and running" page working just find and...
Read more >
swa start | Static Web Apps CLI
Description​. This command is used to start the Azure Static Web Apps emulator from a directory or bind to a dev server.
Read more >
Troubleshooting Azure Static Web Apps - Microsoft Learn
Ensure the folder property is configured correctly in your workflow file. Either no Api directory was specified, or the specified directory was ...
Read more >
crosh/crosh - chromiumos/platform2 - Git at Google
option takes the size of the swap area (in megabytes before compression). ... The start/stop options turn swap on/off immediately, but leave the...
Read more >
Troubleshoot Dataflow errors - Google Cloud
This error occurs if the pipeline could not be started due to Google Compute Engine metadata limits being exceeded. These limits cannot be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found