UTF-8 encode error when configuring Sentry Addon to Heroku app - django

I am trying to configure Sentry addon on Heroku and I get an error
Encoding error. Please ensure that all data in the request can be interpreted as UTF-8.
I tried both command line and using the dashboard in the browser. I have checked my account settings and don't use any non - English characters.

As noted by Markus Unterwaditzer in the notes to the question, it seems it was an issue with Sentry. I can now confirm that it works.

Related

django-rest-framework-social-oauth2: error 400 - redirect_uri_mismatch

I've been trying to add google login to my django app following this tutorial:
https://github.com/RealmTeam/django-rest-framework-social-oauth2
By following exactly the instructions, everything works fine in local.
However, when I try to replicate the same on the server, I get the following error on the redirect page of the login:
Error 400: redirect_uri_mismatch
redirect_uri: http://localhost:8000/auth/complete/google-oauth2/
What is strange to me is, in my google developer console, I have set up the correct redirect url in my app, as follows:
https://mydjangoapp.com/auth/complete/google-oauth2/
And I have also put 'mydjangoapp.com' under 'Authorised JavaScript origins'.
So my question is, why google keeps telling me that the redirect url is
http://localhost:8000/auth/complete/google-oauth2/
which is not the one I have set up in the console? Perhaps there is something obvious that I'm missing here. Thank you!
Why google keeps telling me that the redirect url is
Because your application is sending its in your code the app is running on http://localhost:8000 and if you are using a client library its probably adding the rest automatically.
http://localhost:8000/auth/complete/google-oauth2/
The redirect uri must exactly match what you are sending from your application.
You need to add
http://localhost:8000/auth/complete/google-oauth2/
Javascript origin is only needed if your code is using javascript.
This video will show you how to fix the error. Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
If you want your code to send https://mydjangoapp.com then your going to have to be running it from https://mydjangoapp.com probably and you may need to figure out how to configure it so that it is running from the correct host.

Enabling logging for OpenLDAP client?

I'm trying to do some authentication inside a Django application using django-auth-ldap via the OpenLDAP client. It's not working so how do I enable some logging?
I CAN make LDAP queries using ldapsearch so fundamentally my config is correct and I tried enabling logging for django-auth-ldap but it just reports an Error(0) which is completely unhelpful.
So how do I enable logging for the OpenLDAP client part of the equation? Ideally I would like to see what queries it is making and using which config is being passed down from django-auth-ldap. I did find ldap.conf but the syntax man page implies there is no logging or debug option.
Stumbled across the answer...
To enable logging via the Django LDAP library, add the following to the settings.py file for your project
AUTH_LDAP_GLOBAL_OPTIONS = {
ldap.OPT_DEBUG_LEVEL: 255
}
The error that this flushed out was that I was using docker-compose and setting some environment values such as LDAP_SERVER="ldap://an.ldap.server.com" - but I should not have been quoting the string as the double-quotes were made part of the value. Removing these got me moving again.

Django inernal server Error

I'm working on a Django website.
When I upload an image and its name is in English, it will be uploaded. But when I try to in Arabic it can't upload, it gives an internal server error.
I think you got unicode error in server.
So set both in system environment then check.
LANG='en_US.UTF-8'
LC_ALL='en_US.UTF-8'
https://code.djangoproject.com/wiki/django_apache_and_mod_wsgi#AdditionalTweaking

CKAN Data Set Errors

I installed CKAN and I am having difficulty with adding the DataStore extension using as a guide Setting Up the DataStore from the latest CKAN docs. When I get to the line
curl -X GET "http://127.0.0.1:5000/api/3/action/datastore_search?resource_id=_table_metadata", I get this reponse: curl: (7) Failed to connect to 127.0.0.1 port 5000: Connection refused.
When I look at a dataset I created through the CKAN instance through my browser, the data preview on my JSON file shows an error:
Dataset Error Screenshot
and trying to click the upper link to download the file directly also gives me a browser error when it goes to the URL:
Browser Data Download Error
I'm not sure what my next steps should be to figure out what's wrong but I think the FileStore is working since I was able to upload a picture and load it for an Organization listing.
The installation is fresh and has all the default settings from the installation guide so I haven't done any special modifications. Thanks for your help in advance.
Because k-nut's suggestion was the answer but it's in a comment to my question, I thought I'd post an official answer in case anyone else has the same problem. The ckan.site_url needs to be set to the specific URL that CKAN is running under which may not necessarily be a generic one, even if everything else is default configured. In my case, I have a specific internal URL for my VM that I needed to set.
For me ckan.site_url was set to http://demo.ckan.org and http://localhost
took me to the CKAN page as specified in the installation tutorial, then I figured the port used was 8080 and not 5000 by going to http://localhost:8080.
So, I ended up using curl -X GET "http://127.0.0.1:8080/api/3/action/datastore_search?resource_id=_table_metadata" url instead.

AWS Command Line Tools need recoding for secure login?

The AWS command line tools appear to be broken on both Linux (Ubuntu PP) and Windows (7). In both cases, after setting up the login credentials correctly and trying to run the most basic tool (getBalance.sh), I get a failure to authenticate.
An error occurred while fetching your balance: This request must be made over a secure channel. You must use 'https' rather than 'http'.
Seems simple enough, but there's nothing in the manual nor in the installed directory which would suggest that this is an option supported by the command line tools.
Has someone already modified the shell scripts to use a secured connection? If not, any clues as to where I should begin the modifications?
I haven't used the tools extensively so can't say this solution is extensively tested but getBalance.sh worked after doing this
See this thread:
https://forums.aws.amazon.com/message.jspa?messageID=333485
From the link:
Edit the Command Line Tools Installation Directory\bin\mturk.properties file and edit the service_url to use https instead of http – i.e. https://mechanicalturk.amazonaws.com/?Service=AWSMechanicalTurkRequester for production, and https://mechanicalturk.sandbox.amazonaws.com/?Service=AWSMechanicalTurkRequester for sandbox.