CloudFoundry node-mongodb app always return 502 - cloud-foundry

I followed steps provided by cloudfoundry guide page:
http://cndocs.cloudfoundry.com/services/mongodb/nodejs-mongodb.html
The first two steps are ok, both local and server works.
But when I add code to connect mongodb, it works in local, but in server, it just returns 502.
Anyone has clue?
my site is: http://daniel-mongo.cloudfoundry.com/

have you taken a look at the logs for the application to see what might potentially be going wrong? You can view them by using the logs command in VMC.

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.

Postman Monitoring request error "Error: NETERR: getaddrinfo ENOTFOUND localhost"

I am trying to figure out how to get monitoring to work in Postman.
I have written tests on the desktop client for get/create/put and everything works fine. I'm using a localhost address and port 5004 which is the port for the API.
http://127.0.0.1:5004/bookings
I have tried to change the proxy in setting to localhost and port 5004, I have tried to change it to 127.0.0.1:5004, I have tried to disable SSL on the desktop client. I am running the monitoring on using the desktop client from the browser, that doesn't work either.
I have also checked if my etc/host file contains 127.0.0.1 localhost and it does.
Not sure what else I can try, I would appreciate any help. :)
Accessible APIs:
Monitors require all URLs to be publicly available on the internet as
they run in the Postman cloud. A monitor cannot directly access your
localhost or run requests behind a firewall. However, to overcome this
issue, static IPs are available on Postman Business and Enterprise
plans.
https://learning.postman.com/docs/designing-and-developing-your-api/monitoring-your-api/intro-monitors/
you cannot use the monitor for inhouse and localhost websites, You could upgrade to enterprise or business plans and see if that helps
The issue is maybe you configured the environment variable and passed the correct value in the URL also
But while running the collection test class
didn't select the correct environment
Select the environment configured to run that collection, shown in attached screenshot
I faced this problem and the issue was my DNS address. After changing the DNS server it was solved.
I had the same problem, I had space between ip and :port =>0.0.0.0b:1111 in my env. I deleted the space and I can connect. => 0.0.0.0:1111.
I faced the same issue and it got solved by removing the env variable
what you should try is sign out, sign in again. make sure the environment variables are not empty.
also, try using the feature console.log(get environment variable name) it would be helpful.
make sure to click on persist all in the environment variable.
The key for me was to click on "persist all" in the environment variable
read the github
some comments which helped me resolve the issue

Running flask server on google colab through ngrok flask limiter not working

I am running a debug flask server on a google colab notebook through ngrok, i followed this article mainly: https://medium.com/#kshitijvijay271199/flask-on-google-colab-f6525986797b
I called this endpoint in a loop and pretty soon, a few number of requests came back with status 429. Next, I installed flask limiter, and tried to exempt that endpoint so I can send in high frequency requests. This didn't seem to work as I still got 429. I double checked the code for that flask limiter and couldn't spot any mistakes.
So I begin to think it may be the ngrok tunnel that's raising the 429 on my behalf (or overriding me)? Has anyone run into this and know for sure ngrok put a limit on you regardless of how you configure flask limiter?
I can provide code snippet upon request. But i hope anyone with more experience using the ngrok service can give me a feedback. (I will soon migrate to a permanent VM instead of colab and probably will find out soon and report back in case no one answers).
This seems to have something to do with ngrok. Once I switched to a permanent VM and run it directly (without going through ngrok), there's no problem and the no limit seems to be respected.

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.

Facebook Connect not setting cookies

I'm trying to implement Facebook Connect on a website with .NET MVC using C#.
I've followed the instructions here: http://wiki.developers.facebook.com/index.php/Trying_Out_Facebook_Connect step by step. I can make the login work as in that when I log in through the site I'm also logged into Facebook.
In order to work with this in the server I think I need to access the cookies Facebook is supposed to leave like:
APIKEY_user
APIKEY_session_key
...
as mentioned here http://wiki.developers.facebook.com/index.php/Verifying_The_Signature.
The thing is I'm not getting any of these cookies. I've googled and it seems like I'm the only person with this problem. Any ideas as to what I could be doing wrong ? Has this happened to anyone else ?
The issue was that I was developing locally using localhost.
I resolved the problem by changing the settings for the application to point to a certain web address instead of localhost and changing my hosts file lo point that same web address to 127.0.0.1
from the UI/client-side perspective, always insure you have the correct path indicated for the xd_receiver file in your FB.init() method.
Firecookie is very useful for seeing what Cookies are/aren't being set.