mongodb / stitch-js-sdk

MongoDB Stitch JavaScript SDK
Apache License 2.0
113 stars 67 forks source link

ReferenceError: self is not defined #419

Open daploydev opened 4 years ago

daploydev commented 4 years ago

Trying to use nextjs with the npm sdk and getting self is not defined from node_modules\whatwg-fetch\dist\fetch.umd.js should I use the script sdk in head instead

djodjo02130 commented 4 years ago

I got same problem as you ! I hope project will add method to make isomorphic fetch or something to fix this bug.

daploydev commented 4 years ago

I was able to get anon auth working with stitch and next but you need to put the javscript sdk in the head tag and not install it as a node module and then a small script to initialize your app id and log the user in when the page loads in the browser.

djodjo02130 commented 4 years ago

This tricks works but if we use next js or parcels we need to use this as module.

I hope they will fix this bug :/