dbx.filesListFolder - TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
See original GitHub issueHi,
I am having the same issue as This bug that was recently closed.
I have installed the dropbox SDK in npm (in package.json: “dropbox”: “^7.3.0”) for use in react (browser, not using node).
Running this code:
componentDidMount() { this.listRecordings(); }
listRecordings() {
let dbx = new Dropbox({
accessToken: getAccessTokenFromUrl()
});
dbx.filesListFolder({ path: '' })
.then(res => console.log(res))
.catch(function(error) {
console.error(error);
});
Outputs this error in the console:
TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation at Dropbox-sdk.min.js:1
I am able to successfully call and walk through authentication process with:
var dbx = new Dropbox({ clientId: CLIENT_ID }); dbx.auth.getAuthenticationUrl('http://localhost:3000/')
in another react component and parse the token which appears in the URL successfully with getAccessTokenFromUrl().
Not sure why I am unable to list folders – I think there’s some issue with accessing “window.fetch” but unsure where it comes from.
I have tried reverting to versions 6.0.2 and still get the same error.
Any response on this bug would be greatly appreciated – it looks quite similar to the one you have recently squashed! @greg-db @rogebrd
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Hello Josh,
I am not super familiar with how
fetch
works in a React app so bear with me but could you try addingfetch: fetch
as a parameter to the constructor?I decided to just hit the Dropbox API myself because it was being really buggy. In case this might help anyone, try something like this: