th0rgall/voc-api

TypeError: Cannot read property 'then' of undefined at VocAPI.getDefinition

Closed this issue · 3 comments

I am getting this when calling from my react app

Yes, I am using create react app and calling the api exactly as you mentioned.
I am looking forward for the issue to be fixed. Please fix it ASAP.

Hey @vikash423q, I looked at this issue in more detail today; I could reproduce it. The cause was a wrong version of voc-http, a subproject of this API. I updated the version. It should be fixed now, thanks again for reporting.

Unfortunately though, I realized you can probably not use the API in your React App (or any other regular web app). You will run into CORS restrictions.

This API was built for a web extension, an environment that can circumvent CORS restrictions and other browser safety measures. Unless your React app is running inside a web extension background page, it won't work. I clarified this now in the readme too.