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.

API shell text does not apply to Windows

See original GitHub issue

Describe the bug When failing to connect to the daemon, the webui shows shell prompts that are invalid on Windows. shell


ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '["http://127.0.0.1:8080", "http://127.0.0.1:5001", "https://webui.ipfs.io"]' returns these messages in:

  • PowerShell: Error: failed to unmarshal json. invalid character 'h' looking for beginning of value
  • CMD: Error: Unknown Command "API.HTTPHeaders.Access-Control-Allow-Origin"

Valid forms of this are:

  • PowerShell: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin '[\"http://127.0.0.1:8080\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\"]' ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '[\"PUT\", \"GET\", \"POST\"]'
  • CMD: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "["""http://127.0.0.1:8080""", """http://127.0.0.1:5001""", """https://webui.ipfs.io"""]" ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "["""PUT""", """GET""", """POST"""]"

It would be nice if the shell element had some way to select what command shell you’re using, and formatted the string so the arguments matched the escape type.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
abdenoursouidicommented, Jan 27, 2020

You are a hero ♥

0reactions
itm-platformcommented, Feb 16, 2022

Hi there, I tried both (Windows 11)

  • PowerShell: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials '[\"true\"]'
  • CMD: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "["""true"""]" And I get in both cases
 failure to decode config: json: cannot unmarshal string into Go struct field API.API.HTTPHeaders of type []string

I also tried all forms of adding the config file

  "API": {
    "HTTPHeaders": {
	"Access-Control-Allow-Origin": "['*']"
	}
  }

But I get the same error. Any ideas?

Read more comments on GitHub >

github_iconTop Results From Across the Web

cURL POST command line on WINDOWS RESTful service
My problem: Using the command line tool to curl my localhost server while sending some data along with my POST request is not...
Read more >
Windows Terminal Troubleshooting | Microsoft Learn
Learn fixes to common obstacles in Windows Terminal.
Read more >
ShellExecuteExW function (shellapi.h) - Win32 - Microsoft Learn
Performs an operation on a specified file. (ShellExecuteExW)
Read more >
The Windows Shell - Win32 apps | Microsoft Learn
Specifies application information to return from IShellApp::GetAppInfo. These flags are bitmasks used in the dwMask member of the APPINFODATA ...
Read more >
Introducing the Windows Pseudo Console (ConPTY)
Text emitted by the application is sent to the slave and is then ... Runs as usual, reading input and calling Console APIs...
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