Installing the Framework (Problem cURL error 6: Could not resolve host: cache-proxy)

霸气de小男生 提交于 2019-12-11 04:29:34

问题


I tried to install api-platform: https://api-platform.com/docs/distribution/

after starting I see in the log "api-platform-242_cache-proxy_1"

│   Error:                                                                                                                                                                                                                                                    │
│   Message from VCC-compiler:                                                                                                                                                                                                                                │
│   Expected return action name.                                                                                                                                                                                                                              │
│   ('/usr/local/etc/varnish/default.vcl' Line 67 Pos 13)                                                                                                                                                                                                     │
│       return (miss);                                                                                                                                                                                                                                        │
│   ------------####--                                                                                                                                                                                                                                        │
│   Running VCC-compiler failed, exited with 2                                                                                                                                                                                                                │
│   VCL compilation failed  

If I use the api (post greeting), the response code is 500 "hydra:description": "cURL error 6: Could not resolve host: cache-proxy (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)", "trace": [

Nevertheless the entity is still inserted.

Furthermore I tried the api-platform without docker (Apache). I removed the line VARNISH_URL=http://cache-proxy in the .env file. Then the return code is 500 with "cURL error 3: malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)"

Do you have any idea?

Kind regards Ludi


回答1:


Remove varnish from api_platform.yaml




回答2:


I believe you should remove or comment out VARNISH_URL=http://cache-proxy from .env file not from api_platform.yaml as your .env can change and is/should be host dependent and configuration (.yaml) should not.

See: https://symfony.com/doc/current/configuration.html#the-env-file-environment-variables

There is also a .env file which is loaded and its contents become environment variables. This is useful during development, or if setting environment variables is difficult for your deployment.

In api_platform.yaml you SHOULD comment out whole http_cache section or you will keep getting cURL errors about malformed from guzzle.

{ "@context": "/api-platform/api/public/contexts/Error", "@type": "hydra:Error", "hydra:title": "An error occurred", "hydra:description": "cURL error 3: <url> malformed (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)", "trace": [ { "namespace": "", "short_class": "", "class": "", "type": "", "function": "", "file": "...\\api-platform\\api\\vendor\\guzzlehttp\\guzzle\\src\\Handler\\CurlFactory.php", "line": 186, "args": [] },

Effect is the same.




回答3:


I had the same problem, and I resolved it!

As specified here: https://github.com/api-platform/api-platform/issues/777, the problem is the directories/files rights, so instead of downloading the zip or tar.gz archive, I cloned the repo,

All commands I made (after installing Docker for Windows and enabling Shared Drives in Docker for Windows settings):

cd my_parent_directory
git clone https://github.com/api-platform/api-platform.git
cd api-platform
docker-compose pull
docker-compose up -d

And when I go on https://localhost:8443 all work!!

I hope this helps you :)



来源:https://stackoverflow.com/questions/55591888/installing-the-framework-problem-curl-error-6-could-not-resolve-host-cache-pr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!