You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
[master] entrypoint like /api/index.jsonld return an HTTP 404 with PHP built-in server #502
Where can i setup the entrypoint ? what's wrong with my configuration ?
System : Symfony4 with Flex, ApiPlatform on master branch
api_platform.yaml :
api_platform:
title: 'My comics library'
description: 'Demo of an API built with Api-Platform v2 (use REST or GraphQL). My comics library allow to manage your comics collection in a simple way'
version: '1.0.0'
mapping:
paths: ['%kernel.project_dir%/src/Entity']
formats:
jsonld: ['application/ld+json']
json: ['application/json']
html: ['text/html']
graphql:
graphiql:
enabled: true
-------------------------------------------- -------- -------- ------ --------------------------------------------
Name Method Scheme Host Path
-------------------------------------------- -------- -------- ------ --------------------------------------------
app_apiplatformreactadmin_index GET ANY ANY /demo/api-platform-admin
token ANY ANY ANY /token
token_check ANY ANY ANY /token_check
app_default_index ANY ANY ANY /
app_form_index GET ANY ANY /demo/form
app_hello_world GET ANY ANY /demo/hello/{name}
app_httpplug_call GET ANY ANY /demo/http-plug
demo_secured_page GET ANY ANY /demo/login/secured
demo_login_standard ANY ANY ANY /demo/login/standard
demo_login_json ANY ANY ANY /demo/login/json
app_quasar_index GET ANY ANY /demo/quasar
app_vuejs_index GET ANY ANY /demo/vuejs
api_entrypoint ANY ANY ANY /api/{index}.{_format}
api_doc ANY ANY ANY /api/docs.{_format}
api_graphql_entrypoint ANY ANY ANY /api/graphql
api_jsonld_context ANY ANY ANY /api/contexts/{shortName}.{_format}
api_authors_get_collection GET ANY ANY /api/authors.{_format}
api_authors_post_collection POST ANY ANY /api/authors.{_format}
api_authors_get_item GET ANY ANY /api/authors/{id}.{_format}
api_authors_delete_item DELETE ANY ANY /api/authors/{id}.{_format}
api_authors_put_item PUT ANY ANY /api/authors/{id}.{_format}
api_books_get_collection GET ANY ANY /api/books.{_format}
api_books_post_collection POST ANY ANY /api/books.{_format}
api_books_get_item GET ANY ANY /api/books/{id}.{_format}
api_books_delete_item DELETE ANY ANY /api/books/{id}.{_format}
api_books_put_item PUT ANY ANY /api/books/{id}.{_format}
api_books_reviews_get_subresource GET ANY ANY /api/books/{id}/reviews.{_format}
api_editors_get_collection GET ANY ANY /api/editors.{_format}
api_editors_post_collection POST ANY ANY /api/editors.{_format}
api_editors_get_item GET ANY ANY /api/editors/{id}.{_format}
api_editors_delete_item DELETE ANY ANY /api/editors/{id}.{_format}
api_editors_put_item PUT ANY ANY /api/editors/{id}.{_format}
api_jobs_get_collection GET ANY ANY /api/jobs.{_format}
api_jobs_post_collection POST ANY ANY /api/jobs.{_format}
api_jobs_get_item GET ANY ANY /api/jobs/{id}.{_format}
api_jobs_delete_item DELETE ANY ANY /api/jobs/{id}.{_format}
api_jobs_put_item PUT ANY ANY /api/jobs/{id}.{_format}
api_project_book_creations_get_collection GET ANY ANY /api/project_book_creations.{_format}
api_project_book_creations_post_collection POST ANY ANY /api/project_book_creations.{_format}
api_project_book_creations_get_item GET ANY ANY /api/project_book_creations/{id}.{_format}
api_project_book_creations_delete_item DELETE ANY ANY /api/project_book_creations/{id}.{_format}
api_project_book_creations_put_item PUT ANY ANY /api/project_book_creations/{id}.{_format}
api_project_book_editions_get_collection GET ANY ANY /api/project_book_editions.{_format}
api_project_book_editions_post_collection POST ANY ANY /api/project_book_editions.{_format}
api_project_book_editions_get_item GET ANY ANY /api/project_book_editions/{id}.{_format}
api_project_book_editions_delete_item DELETE ANY ANY /api/project_book_editions/{id}.{_format}
api_project_book_editions_put_item PUT ANY ANY /api/project_book_editions/{id}.{_format}
api_reviews_get_collection GET ANY ANY /api/reviews.{_format}
api_reviews_post_collection POST ANY ANY /api/reviews.{_format}
api_reviews_get_item GET ANY ANY /api/reviews/{id}.{_format}
api_reviews_delete_item DELETE ANY ANY /api/reviews/{id}.{_format}
api_reviews_put_item PUT ANY ANY /api/reviews/{id}.{_format}
api_reviews_book_get_subresource GET ANY ANY /api/reviews/{id}/book.{_format}
api_series_get_collection GET ANY ANY /api/series.{_format}
api_series_post_collection POST ANY ANY /api/series.{_format}
api_series_get_item GET ANY ANY /api/series/{id}.{_format}
api_series_delete_item DELETE ANY ANY /api/series/{id}.{_format}
api_series_put_item PUT ANY ANY /api/series/{id}.{_format}
api_series_books_get_subresource GET ANY ANY /api/series/{id}/books.{_format}
easyadmin ANY ANY ANY /admin/
admin ANY ANY ANY /admin/
_twig_error_test ANY ANY ANY /_error/{code}.{_format}
_wdt ANY ANY ANY /_wdt/{token}
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
index ANY ANY ANY /
simple GET ANY ANY /demo/simple
demo_login_standard_check ANY ANY ANY /demo/login/authenticate
logout ANY ANY ANY /logout
-------------------------------------------- -------- -------- ------ --------------------------------------------
@dunglas any option to solve that problem ? it seems that this feature works well with 2.1.4 (i downloaded this release, put my entities inside, and removed ApiSubResource annotation and it Works) but it fails on master
So : the problemd doesn't rely on master, but maybe in the way i installed ApiPlatform.
if i download the official distribution (release 2.1.4), and update the api-platfom/core to dev-master with composer, then everything works well
if i use Symfony4 with flex and add api from recipes it seems to not be enough. Here is the full require done with composer on my projet : composer req encore annotations twig api http profiler log doctrine-migrations admin
Here are the steps to reproduce the problem with flex and api:
Create a symfony project with flex (and cd into for all other commands):
<?php
namespace App\Entity\Library;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
/**
* @ApiResource(
* iri="http://schema.org/Role"
* )
* @ORM\Entity
*/
class Job
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ApiProperty(
* iri="http://schema.org/name"
* )
* @ORM\Column(type="string", length=256, nullable=false)
*/
private $tanslation_key;
/**
* id can be null until flush is done
* @return int
*/
public function getId(): ?int
{
return $this->id;
}
/**
* @return string
*/
public function getTanslationKey(): string
{
return $this->tanslation_key;
}
/**
* @param mixed $tanslation_key
* @return Job
*/
public function setTanslationKey($tanslation_key): Job
{
$this->tanslation_key = $tanslation_key;
return $this;
}
}
Run a server:
php -S localhost:8001 -t public
With your browser go on localhost:8002/api: You should see the swagger UI with the Job entity
Then click on the link jsonld at the bottom right of the screen: You will have a 404 Not Found
So i expect something wrong with the way i install the api-platform. Am i missing something in the dependancies ?
changed the title [-]How to configure the entrypoint ? /api/index.json leads to a 404[/-][+][master] entrypoint like /api/index.jsonld return an HTTP 404[/+]on Jan 9, 2018
@Rebolon Have you find a fix ? I'm running on the same situation and even api_doc routes produce 404, which is annoying/blocking for testing with the admin app. Have you the same issue on those routes by the way ?
Thanks.
Edit : I was using php built-in server, since I've set up a nginx server and everything seems working.
thanks @o-rel in fact it works with nginx, but not with php built-in server @dunglas what features is mandatory on the server http that prevent the app to run on a php built-in server ?
changed the title [-][master] entrypoint like /api/index.jsonld return an HTTP 404[/-][+][master] entrypoint like /api/index.jsonld return an HTTP 404 with PHP built-in server[/+]on Jan 15, 2018
Activity
dunglas commentedon Dec 28, 2017
Can you paste the output of
bin/console debug:router? Does clearing the cache (rm -Rf var/cache) help?Rebolon commentedon Dec 28, 2017
Clearing the cache doesn't solve the problem.
Here is the debug:router output
Rebolon commentedon Jan 3, 2018
I tried with the latest version of api-platform/core: master and it still fail
Rebolon commentedon Jan 8, 2018
@dunglas any option to solve that problem ? it seems that this feature works well with 2.1.4 (i downloaded this release, put my entities inside, and removed ApiSubResource annotation and it Works) but it fails on master
Rebolon commentedon Jan 9, 2018
So : the problemd doesn't rely on master, but maybe in the way i installed ApiPlatform.
apifrom recipes it seems to not be enough. Here is the full require done with composer on my projet :composer req encore annotations twig api http profiler log doctrine-migrations adminHere are the steps to reproduce the problem with flex and api:
Create a symfony project with flex (and cd into for all other commands):
Edit your composer.json and add this (it reproduce the recipes api but with api-platform/core on master branch) :
Then run those command to add required packages (for api and graphql):
Add an entity in your src/Entity:
Run a server:
With your browser go on localhost:8002/api: You should see the swagger UI with the Job entity
Then click on the link jsonld at the bottom right of the screen: You will have a 404 Not Found
So i expect something wrong with the way i install the api-platform. Am i missing something in the dependancies ?
[-]How to configure the entrypoint ? /api/index.json leads to a 404[/-][+][master] entrypoint like /api/index.jsonld return an HTTP 404[/+]o-rel commentedon Jan 13, 2018
@Rebolon Have you find a fix ? I'm running on the same situation and even api_doc routes produce 404, which is annoying/blocking for testing with the admin app. Have you the same issue on those routes by the way ?
Thanks.
Edit : I was using php built-in server, since I've set up a nginx server and everything seems working.
Rebolon commentedon Jan 15, 2018
It's not fixed on my side.
I also run a php built-in server : i will try nginx to check if it solves this problem
Rebolon commentedon Jan 15, 2018
thanks @o-rel in fact it works with nginx, but not with php built-in server
@dunglas what features is mandatory on the server http that prevent the app to run on a php built-in server ?
[-][master] entrypoint like /api/index.jsonld return an HTTP 404[/-][+][master] entrypoint like /api/index.jsonld return an HTTP 404 with PHP built-in server[/+]bierdok commentedon Mar 26, 2018
Add those lines like Silex documentation suggests
public/index.php
Run the built-in server:
$ php -S localhost:8000 -t public index.phpVoila!
dunglas commentedon Mar 26, 2018
We probably need to patch Symfony's index.php directly.
bierdok commentedon Mar 28, 2018
Another solution more simple would be to use Symfony's one: https://symfony.com/doc/master/setup/built_in_web_server.html