Open PetrShchukin opened 4 years ago
Are you using this from browser? Maybe Bitbucket doesn't allow cross-origin requests anymore 🤷♂️
I just ran your code here: https://npm.runkit.com/bitbucket and it worked alright.
It works from npm.runkit.com... I've created react app, tried from there, but got a cors error. With an axios request and their rest api it works fine =/
Can you show me a minimal project with this bug?
I can use it without any problem here: https://codesandbox.io/s/bitbucket-with-cra-c5rk2
But your example doesn't work... I'm getting 500 error, probably the original error on codesandbox is hidden
"{"name":"HTTPError","headers":{},"request":{"method":"GET","url":"https://api.bitbucket.org/2.0/repositories/MunifTanjim","headers":{"accept":"application/json","user-agent":"bitbucket.js/2.1.0"},"request":{"validate":{"role":{"enum":["admin","contributor","member","owner"],"type":"string"},"workspace":{"required":true,"type":"string"}}}},"status":500}"
Strange :thinking: I was working yesterday when I created that sandbox. Now it's not working anymore!
Now it's working again!
Still getting a 500 error on codesandbox and cors in a react app 🤷♂️. I've created a react app by using 'npx create-react-app myapp', then 'yarn add bitbucket', then simply add
const bitbucket = new Bitbucket();
React.useEffect(() => {
bitbucket.repositories
.list({ workspace: "MunifTanjim" })
.then(({ data }) => console.log(data))
.catch(err => {
console.error(err);
});
}, [bitbucket.repositories]);
to App.js
Is there a working example? I'm tying
but having a cors error. "bitbucket": "^2.1.0",