Closed calikevuche closed 4 years ago
@calikevuche This may be related https://github.com/ipfs/js-ipfs-http-client/pull/1222/files#diff-a2458e7a9c5348e076b46fb8dd29d473R12
(That link is in an unmerged PR that will modify the upload-file-via-browswer
example)
@pcowgill when I run the upload-file-via-brower, I get the following error:
Access to fetch at 'http://127.0.0.1:5001/api/v0/add?stream-channels=true&progress=true' from origin 'http://localhost:1234' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I have the following in my config:
"HTTPHeaders": {
"Access-Control-Allow-Headers": [
"Authorization"
],
"Access-Control-Allow-Methods": [
"PUT",
"POST",
"GET"
],
"Access-Control-Allow-Origin": [
"*"
]
}
@calikevuche Did you follow these instructions too? https://github.com/ipfs/js-ipfs-http-client#cors
This example has been fixed in https://github.com/ipfs/js-ipfs-http-client/pull/1222
Hello All, I have the ipsf daemon running in the background, successfully. However, when I try to run the example, upload-file-via-browswer, in js-ipfs-http-client repo, I get the following error on my chrome browser:
Uncaught TypeError: Failed to construct 'URL': Invalid URL at getNonRootPath (configure.js:93) at eval (configure.js:27) at ipfsClient (index.js:21) at new App (App.js:47) at constructClassInstance (react-dom.development.js:12484) at updateClassComponent (react-dom.development.js:14255) at beginWork (react-dom.development.js:15082) at performUnitOfWork (react-dom.development.js:17820) at workLoop (react-dom.development.js:17860) at HTMLUnknownElement.callCallback (react-dom.development.js:149) It seems that “localhost” is being passed into const apiAddrPath = getNonRootPath(…) in configure.js. Please let me know if there is a workaround for this error. If I am doing something wrong configuration wise, do provide some guidance.
Cheers,