Error "Couldn't reach API" when I try to log in - php

I install Directus CMS via git clone successful. In the database 15 tables were created. In /config folder my projectkey.php file were created too.
After installation I want to login with my credentials and get the error "Couldn't reach API".
In PHP Error log -> no entry
In Directus log -> no entry
REST calls:
authenticate/ -> Code 200; Response: data/user
projectkey/ -> Code 200; Response: data/api
ping/ -> Code 200; Response: Pong
In a working instance I have seen that in API Call projectkey/ are more properties. For example data/server is missing in my instance.
Does anyone have any idea what this could be?

Version 8.5.X solved my problem

I had the same error and found the solution in the project's corresponding issue:
Check that you're using HTTPS on webservers and local... that is a new requirement added in 8.7.2 due to a cookie policy change by Chrome et al. If it STILL is an issue, please open a new ticket with exact/specific information. Thanks! 👍
Also, just as a reminder, this is a VERY generic error and could shown for several different root causes. More specific error handling/codes is something we're adding in v9.
Enabling SSL fixed it for me.

Related

SilverStripe - The website server has not been able to respond to your request

I'm trying to create my first SilverStripe website following this tutorial.
So far I have created my website and configured my .env page.
# DB credentials
SS_DATABASE_CLASS="MySQLDatabase"
SS_DATABASE_SERVER="localhost"
SS_DATABASE_USERNAME="root"
SS_DATABASE_PASSWORD=""
SS_DATABASE_NAME="SS_examples"
SS_ENVIRONMENT_TYPE="dev"
I'm not sure entirely how the database is created when creating a site. I checked my databases and I do not have one for it. I can make one manually but I wasn't sure if I should and list it under SS_DATABASE_NAME, or if it will auto-create the db.
I'm assuming this is why when I visit my local site localhost/SSexample/public I get an error saying "The website server has not been able to respond to your request".
Am I missing a step in setting up the site or should I manually create a db named SS_examples?
on a side note my apache server is set up with xampp and my SilverStripe project is in C:/xamp/htdocs.
Steps I took to create site:
Built site in C:\xampp\htdocs by running: composer create-project silverstripe/installer SSexample
Visited my project by going to localhost/SSexample/public
created .env file as listed above
ERROR LOGS
[2019-12-31 22:29:22] error-log.ERROR: Uncaught Exception SilverStripe\ORM\Connect\DatabaseException: "Couldn't run query: SELECT DISTINCT "SiteConfig"."ClassName", "SiteConfig"."LastEdited", "SiteConfig"."Created", "SiteConfig"."Title", "SiteConfig"."Tagline", "SiteConfig"."CanViewType", "SiteConfig"."CanEditType", "SiteConfig"."CanCreateTopLevelType", "SiteConfig"."ID", CASE WHEN "SiteConfig"."ClassName" IS NOT NULL THEN "SiteConfig"."ClassName" ELSE 'SilverStripe\\SiteConfig\\SiteConfig' END AS "RecordClassName" FROM "SiteConfig" LIMIT 1 Table 'ss_lessons.siteconfig' doesn't exist" at C:\xampp\htdocs\SSlessons\vendor\silverstripe\framework\src\ORM\Connect\DBConnector.php line 64 {"exception":"[object] (SilverStripe\\ORM\\Connect\\DatabaseException(code: 0): Couldn't run query:\n\nSELECT DISTINCT \"SiteConfig\".\"ClassName\", \"SiteConfig\".\"LastEdited\", \"SiteConfig\".\"Created\", \"SiteConfig\".\"Title\", \"SiteConfig\".\"Tagline\", \"SiteConfig\".\"CanViewType\", \"SiteConfig\".\"CanEditType\", \"SiteConfig\".\"CanCreateTopLevelType\", \"SiteConfig\".\"ID\", \n\t\t\tCASE WHEN \"SiteConfig\".\"ClassName\" IS NOT NULL THEN \"SiteConfig\".\"ClassName\"\n\t\t\tELSE 'SilverStripe\\\\SiteConfig\\\\SiteConfig' END AS \"RecordClassName\"\n\r\nFROM \"SiteConfig\"\n\r\nLIMIT 1\n\nTable 'ss_lessons.siteconfig' doesn't exist at C:\\xampp\\htdocs\\SSlessons\\vendor\\silverstripe\\framework\\src\\ORM\\Connect\\DBConnector.php:64)"} []
It seems that the installer at localhost/SSexample/public should allow you to configure your database connection settings (and create the database for you).
Getting The website server has not been able to respond to your request error means that you have a problem with webserver - is it running?
EDIT: The website server has not been able to respond to your request is actually Silverstripe's generic error 500 message.
EDIT2: one has to enable dev environment - by adding SS_ENVIRONMENT_TYPE="dev" to .env file and then access localhost/SSexample/public/dev/build to get database created and populated.

Laravel based REST API: Getting images

First of all, sorry if this question is answered anywhere else, but I could not find the answer I needed so I'll ask again.
I am using laravel to create a REST API which I serve through Docker. Therefore I can reach the API through http://localhost:8888. For example, I have an endpoint /content/fetch/{env_type} which works fine through http://localhost:8888/api/content/fetch/test.
My problem is that I have some images in the (from Laravel root dir) directive /public/images/content/test. I was under the assumption that I would be able to reach these images in my frontend app using <img src="http://localhost:8888/images/content/test/myimage.jpg" /> but this does not work.
I have tried adding public/ before images/... but that did not work either. I also tried the URL to the image in the browser directly, and got 500 Internal Server Error:
Request URL: http://localhost:8888/images/content/test/myimage.jpg
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: 127.0.0.1:8888
Referrer Policy: no-referrer-when-downgrade
Looking in the laravel log I get this: production.ERROR: Uncaught ErrorException: file_put_contents(/var/www/storage/framework/views/ba2564046cc89e436fb993df6f661f314e4d2efb.php): failed to open stream: Permission denied in /var/www/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122
I know what it means but it feels strange that I should have to change the permissions for basically the entire vendor folder.
So my guess is that I am approaching this wrong. Does anyone have an idea how I should do this instead?

Failed to connect to Recurly Could not resolve host

I'm currently developing a plugin for wordpress that uses recurly for subscription. I already uploaded it to our site and resume coding there. I'm already done with the checkout page and was in the middle of developing the accounts page when I run into an error:
Fatal error: Uncaught exception 'Recurly_ConnectionError' with message 'Failed to connect to Recurly (Could not resolve host: xx-my-subdomain-xx.recurly.com)
xx-my-subdomain-xx is the placeholder for the subdomain
I already increased the connection timeout to 30 but my effort was futile. I tried testing it in my localhost and found out that it was working. I think i has something to do with the cURL but I can't point out what's causing the problem.
Any help would be appreciated.
Recurly_Client::$subdomain = 'your-subdomain-name'; // i.e devapp,myapp..etc
You don't need to write whole subdomain URL you just need to pass your subdomain name which is found in configuration -> site setting (Only the name of the subdomain).
I hope this will solve your issue as I also got the same error after this change its working fine for me.
Provide your subdomain as follows
Recurly_Client::$subdomain = "Your RECURLY_SUBDOMAIN";
Then add your API key and certificate path as follows
Recurly_Client::$apiKey = "Your RECURLY_API_KEY";
Recurly_Client::$CACertPath = "Your RECURLY_OPENSSL_CertificatePATH";
I hope this will work for you.

how to configure facebook api in localhost in xampp or wamp server? what is php.ini settings requirement to use it?

I m new to use of facebook api after some googling i found facebook api from this link:
https://github.com/facebook/facebook-php-sdk
after download this package i try to execute example code from this package but it returns an error like:
Fatal error: Uncaught CurlException: 6: Could not resolve host: graph.facebook.com; Host not found thrown in D:\xampp\htdocs\testing\phpdemo\fb\src\base_facebook.php on line 994
to solve this problem i try too much googling but i doesnt get positive result from there.
If anybody know what kind of possibilities for this problem then please help.
here is may be two posibilities like:
1) Do you have any firewalls? The problem is not about configuration is just CURL can't do requests to graph.facebook.com and possible any website. Try disable any firewalls that may be blocking your CURL requests
2) From my experience you can't use facebook APi local, however they have a free host provider,Heroku, try it. Also don't forget to replace YOUR_APP_ID and YOUR_APP_SECRET with your app Data.
You can get help here,https://stackoverflow.com/questions/16294630
From my experience you can't use facebook APi local, however they have a free host provider,Heroku, try it.
Also don't forget to replace YOUR_APP_ID and YOUR_APP_SECRET with your app Data.

Twitter OAuth failing to work (PHP)

I have the TwitterOAuth class and demonstration running on a local development server and I cannot get it to authorize. I have entered the new CONSUMER_KEY and CONSUMER_SECRET in the config.php. I have also synced the server time to NTP. I get the error message: 'Could not connect to Twitter. Refresh the page or try again later.'
var_dump($connection->http_code);
results:
int 0
ANY help or advise would be appreciated.
I am running PHP 5.3
When I try to ping the api server I can't.
C:\Users\Owner>ping api.twitter.com
Ping request could not find host api.twitter.com. Please check the name and try
again.
could this be the problem ?
I had some issues with this process as well. I don't exactly recall what resolved this error, but I followed This Tutorial (albeit a bit out of date) and made sure I explicitly set the callback URL in the twitter panel for my app. Also, and I believe this one also caused the int 0 return for me, make sure that if you are going with a hosting provider they allow CURL requests.
step 1: https://apps.twitter.com/app or go to your app setting
step 2: Unchecked the (Enable Callback Locking (It is recommended to enable callback locking to ensure apps cannot overwrite the callback url)) This box..
save and exit and check..
ThankYou..!

Categories