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

HTTPError: 405 Client Error: Method Not Allowed #303

Open
Nikolaj4o opened this issue Oct 21, 2021 · 9 comments
Open

HTTPError: 405 Client Error: Method Not Allowed #303

Nikolaj4o opened this issue Oct 21, 2021 · 9 comments

Comments

@Nikolaj4o
Copy link

connect method throws an exception :

ipfshttpclient.exceptions.StatusError: HTTPError: 405 Client Error: Method Not Allowed for url: http://localhost:5001/api/v0/version?stream-channels=true

Does anyone have any idea what might be causing this?

@devturi
Copy link

devturi commented Oct 29, 2021

Can someone please look into it. We need a solution for it. I am also facing the same issue.

@carsonfarmer
Copy link

I'm seeing the same with latest pip release. Any ideas on the fix here?

@MrBruz
Copy link

MrBruz commented Dec 25, 2021

Same issue here..

@yellowYou
Copy link

same issue

@Selcuk05
Copy link

I am facing this issue too.

@Selcuk05
Copy link

#218 (comment)
This did it for me.

@marcellodesales
Copy link

marcellodesales commented Apr 6, 2022

🔢 Versions

🐞 Bug

  • The server can't request as per the documentation
>>> import ipfsApi
>>> api = ipfsApi.Client('localhost', 5001)
>>> api.id()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/ipfsApi/client.py", line 345, in id
    return self._id.request(self._client, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/ipfsApi/commands.py", line 18, in request
    return client.request(self.path, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/ipfsApi/http.py", line 25, in wrapper
    return f(self, *args, **merged)
  File "/usr/local/lib/python3.9/site-packages/ipfsApi/http.py", line 95, in request
    res.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 405 Client Error: Method Not Allowed for url: http://localhost:5001/api/v0/id?stream-channels=true&encoding=json

🛠️ Config

  • Exposed APIs by swapping 127.0.0.1 with 0.0.0.0
    • 🐳 Running from a Docker container
{
	"API": {
		"HTTPHeaders": {}
	},
	"Addresses": {
		"API": "/ip4/0.0.0.0/tcp/5001",
		"Announce": [],
		"AppendAnnounce": [],
		"Gateway": "/ip4/0.0.0.0/tcp/8080",
		"NoAnnounce": [],
		"Swarm": [
			"/ip4/0.0.0.0/tcp/4001",
			"/ip6/::/tcp/4001",
			"/ip4/0.0.0.0/udp/4001/quic",
			"/ip6/::/udp/4001/quic"
		]
	},
	"AutoNAT": {},
	"Bootstrap": [
		"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
		"/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
		"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
		"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
		"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
		"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt"
	],
	"DNS": {
		"Resolvers": {}
	},
	"Datastore": {
		"BloomFilterSize": 0,
		"GCPeriod": "1h",
		"HashOnRead": false,
		"Spec": {
			"mounts": [
				{
					"child": {
						"path": "blocks",
						"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
						"sync": true,
						"type": "flatfs"
					},
					"mountpoint": "/blocks",
					"prefix": "flatfs.datastore",
					"type": "measure"
				},
				{
					"child": {
						"compression": "none",
						"path": "datastore",
						"type": "levelds"
					},
					"mountpoint": "/",
					"prefix": "leveldb.datastore",
					"type": "measure"
				}
			],
			"type": "mount"
		},
		"StorageGCWatermark": 90,
		"StorageMax": "10GB"
	},
	"Discovery": {
		"MDNS": {
			"Enabled": true,
			"Interval": 10
		}
	},
	"Experimental": {
		"AcceleratedDHTClient": false,
		"FilestoreEnabled": false,
		"GraphsyncEnabled": false,
		"Libp2pStreamMounting": false,
		"P2pHttpProxy": false,
		"StrategicProviding": false,
		"UrlstoreEnabled": false
	},
	"Gateway": {
		"APICommands": [],
		"HTTPHeaders": {
			"Access-Control-Allow-Headers": [
				"X-Requested-With",
				"Range",
				"User-Agent"
			],
			"Access-Control-Allow-Methods": [
				"GET"
			],
			"Access-Control-Allow-Origin": [
				"*"
			]
		},
		"NoDNSLink": false,
		"NoFetch": false,
		"PathPrefixes": [],
		"PublicGateways": null,
		"RootRedirect": "",
		"Writable": false
	},
	"Identity": {
		"PeerID": "12D3KooWQJLcv5StPqv5HeX8V8yzAm9LMZZj4v2FrNUNG6XUmdjC"
	},
	"Internal": {},
	"Ipns": {
		"RecordLifetime": "",
		"RepublishPeriod": "",
		"ResolveCacheSize": 128
	},
	"Migration": {
		"DownloadSources": [],
		"Keep": ""
	},
	"Mounts": {
		"FuseAllowOther": false,
		"IPFS": "/ipfs",
		"IPNS": "/ipns"
	},
	"Peering": {
		"Peers": null
	},
	"Pinning": {
		"RemoteServices": {}
	},
	"Plugins": {
		"Plugins": null
	},
	"Provider": {
		"Strategy": ""
	},
	"Pubsub": {
		"DisableSigning": false,
		"Router": ""
	},
	"Reprovider": {
		"Interval": "12h",
		"Strategy": "all"
	},
	"Routing": {
		"Type": "dht"
	},
	"Swarm": {
		"AddrFilters": null,
		"ConnMgr": {
			"GracePeriod": "20s",
			"HighWater": 900,
			"LowWater": 600,
			"Type": "basic"
		},
		"DisableBandwidthMetrics": false,
		"DisableNatPortMap": false,
		"RelayClient": {},
		"RelayService": {},
		"Transports": {
			"Multiplexers": {},
			"Network": {},
			"Security": {}
		}
	}
}

🎨 IPFS Server new...

  • We can't upgrade anything else.
  • Could this be a server-side setting? Since it's not allowing the HTTP request, but the browser itself opens all the settings properly

Screen Shot 2022-04-05 at 8 04 49 PM

@hemangjoshi37a
Copy link

having same problem in #318

@hemangjoshi37a
Copy link

The error message "HTTPError: 405 Client Error: Method Not Allowed" typically indicates that the server is not allowing the method (such as GET or POST) used in the request. In this case, it seems that the IPFS API server is not allowing the request to the /api/v0/version endpoint.

It's difficult to say exactly what might be causing this issue without more information about your setup, but here are a few things to check:

  1. Verify that the IPFS daemon is running and that it is listening on the correct IP address and port (localhost:5001 by default).
  2. Make sure that the version of the IPFS daemon you are running is compatible with the version of the IPFS API client you are using.
  3. Verify that the IPFS API server is configured to allow the method used in the request. You can do this by checking the IPFS API server's configuration file or by running the ipfs config show command.
  4. Check that the the endpoint is not blocked by any firewall or security group on your network.
  5. Try to connect to the IPFS API server from the command line using curl or httpie to see if you can reproduce the issue and get more information about what is causing it.

It is also possible that the error is caused by a bug in the IPFS API client library that you are using. In this case, you may want to check the library's documentation and issue tracker to see if there are any known issues or workarounds.

Finally, One of the user in the issue thread mentioned that adding api = ipfsApi.Client('http://0.0.0.0', 5001) instead of api = ipfsApi.Client('localhost', 5001) worked for them. This could be an option to test if you haven't done yet.

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

No branches or pull requests

8 participants