Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to fetch the Bearer Token. Error: 500-Internal Server Error #3

Closed
drfraser opened this issue Nov 27, 2020 · 5 comments
Closed

Comments

@drfraser
Copy link

Hi,

I hope I'm not creating more work for you.... I tried using version 2.1.1 after making that patch (see other issue) and I am now getting an error response of

Failed to fetch the Bearer Token. Error: 500-Internal Server Error

and looking at my account stats, no changes to them (e.g. used characters). But a half-hour ago, I was doing testing and it worked, no auth problems.

So I uninstalled 2.1.1, reinstalled 2.1.0 (and fixed the two lines) and everything works ok - did nothing else. Those two lines in topic.py surely don't affect communication with the server, so no idea what is going on here. The change log only shows topic.py being updated for 2.1.1 so this is a bit strange.

Doug

@drfraser
Copy link
Author

drfraser commented Nov 27, 2020

Update: I decided everything was ready to go and started sending docs to the sentiment service. About 650 in, 500 response codes started occurring (sorry, no more detail than that). Things obviously got stuck at some point and so I Ctrl-C the application.

I was logged into the developer portal at the same time so I could monitor what was going at certain points. I Ctrl-Ced everything when the browser page would not refresh / timed out - I got a Gateway Timeout page once. Now it seems I've perhaps triggered some firewall because I can not get any response from the UI (have a blank webpage).

So I will stop. Sorry for breaking something :(

Update: I have processed a lot more documents now and no problems. As far as I can tell, it seems the 500 errors occurred after making a lot of requests with one client. But that may be a incorrect hypothesis. I broke the task up into multiple simultaneous Dask workers/clients and subsets of the whole set of documents [200 - 300 at a time] and have had no more problems.

@drfraser
Copy link
Author

Here is a stack trace I got when using version 2.1.2.

File "/Volumes/Phil/projects/research/holistic/src/holistic/features/featset/expertai.py", line 89, in make_features
output = self.client.full_analysis(
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/cloud/client.py", line 89, in full_analysis
response = self.response_class(response=request.send())
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/cloud/request.py", line 52, in send
http_method, req_parameters = self.setup_raw_request()
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/cloud/request.py", line 62, in setup_raw_request
req_parameters = {"url": self.url, "headers": self.headers}
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/cloud/request.py", line 34, in headers
header = ExpertAiAuth().header
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/common/authentication.py", line 26, in header
value = constants.AUTH_HEADER_VALUE.format(self.fetch_token_value())
File "/Volumes/Phil/projects/research/holistic/venv/lib/python3.8/site-packages/expertai/nlapi/common/authentication.py", line 57, in fetch_token_value
raise ExpertAiRequestError(
expertai.nlapi.common.errors.ExpertAiRequestError: Failed to fetch the Bearer Token. Error: 500-Internal Server Error

If I immediately uninstall 2.1.2, reinstall 2.1.0 and then immediately run my code, everything works fine. If you can give me an idea where to look, I'd be happy to track this down for you - at least what I can from my side. I am only making 1 request at the moment - not a lot like I previously have said.

@marcobellei-eai
Copy link
Collaborator

Hi Doug,

there was a problem in deploying v2.1.2, you should retrieve v2.1.3 that fix the problem.
This should fix the 500 problem.

Thanks
Marco

@drfraser
Copy link
Author

drfraser commented Dec 1, 2020

Hi Marco,

2.1.3 works perfectly. Thanks for being so responsive. FYI, the sentiment analysis looks to be more accurate than any of the other sentiment analysis libraries I have (afinn, pattern.en, SentiStrength, NLTK...) for a subset of the documents I have (the ones with negative polarity). I have to figure out why, but I'm not complaining.

Doug

@marcobellei-eai
Copy link
Collaborator

Hi Doug,

thank you for your patience and for your feedback.

Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants