Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non existing URL results in Crash - 500 Internal Server Error #1030

Open
domibay-hugo opened this issue Jul 8, 2021 · 1 comment
Open

Non existing URL results in Crash - 500 Internal Server Error #1030

domibay-hugo opened this issue Jul 8, 2021 · 1 comment

Comments

@domibay-hugo
Copy link
Contributor

Sending a non existing URL to the server produces an Crash in the Application and results in an Internal Server Error - Status Code 500

$ wget -S -O - https://fastapi.metacpan.org/v1/file/_search?path=Data.pm
--2021-07-08 11:36:53--  https://fastapi.metacpan.org/v1/file/_search?path=Data.pm
Resolviendo fastapi.metacpan.org (fastapi.metacpan.org)... 151.101.134.217, 2a04:4e42:1f::729
Conectando con fastapi.metacpan.org (fastapi.metacpan.org)[151.101.134.217]:443... conectado.
Petición HTTP enviada, esperando respuesta... 
  HTTP/1.1 500 Internal Server Error
  Connection: keep-alive
  Content-Length: 315
  Server: nginx
  Content-Type: application/json; charset=utf-8
  Cache-Control: private
  Fastly-Restarts: 1
  Accept-Ranges: bytes
  Date: Thu, 08 Jul 2021 10:36:53 GMT
  Via: 1.1 varnish
  X-Served-By: cache-mad22053-MAD
  X-Cache: MISS
  X-Cache-Hits: 0
  X-Timer: S1625740614.662722,VS0,VE253
2021-07-08 11:36:53 ERROR 500: Internal Server Error.

in the Browser you can see:

{
   "message" : "[Param] ** Unknown param (index) in (search) request. See docs at: http://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html, called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /home/metacpan/metacpan-api/lib/MetaCPAN/Server/Controller.pm line 122."
}
@domibay-hugo
Copy link
Contributor Author

domibay-hugo commented Jul 8, 2021

When searching a file by this Total Path like File/Data.pm produces a Crash in the Application with Internal Server Error - Status Code 500:

$ wget -S -O - https://fastapi.metacpan.org/v1/file/_search?q=File/Data.pm 
--2021-07-08 11:44:02--  https://fastapi.metacpan.org/v1/file/_search?q=File/Data.pm
Resolviendo fastapi.metacpan.org (fastapi.metacpan.org)... 151.101.134.217, 2a04:4e42:1f::729
Conectando con fastapi.metacpan.org (fastapi.metacpan.org)[151.101.134.217]:443... conectado.
Petición HTTP enviada, esperando respuesta... 
  HTTP/1.1 500 Internal Server Error
  Connection: keep-alive
  Content-Length: 1419
  Server: nginx
  Content-Type: application/json; charset=utf-8
  Cache-Control: private
  Fastly-Restarts: 1
  Accept-Ranges: bytes
  Date: Thu, 08 Jul 2021 10:44:02 GMT
  Via: 1.1 varnish
  X-Served-By: cache-mad22065-MAD
  X-Cache: MISS
  X-Cache-Hits: 0
  X-Timer: S1625741043.719754,VS0,VE276
2021-07-08 11:44:03 ERROR 500: Internal Server Error.

in the Browser you can see:

{
   "message" : "[Request] ** [http://127.0.0.1:9200]-[400] [query_parsing_exception] Failed to parse query [file/Data.pm], with: {\"index\":\"cpan_v1_01\"}, called from sub Search::Elasticsearch::Role::Client::Direct::__ANON__ at /home/metacpan/metacpan-api/lib/MetaCPAN/Server/Controller.pm line 122. With vars: {'request' => {'method' => 'GET','body' => undef,'serialize' => 'std','path' => '/cpan/file/_search','qs' => {'q' => 'file/Data.pm'},'ignore' => []},'status_code' => 400,'body' => {'status' => 400,'error' => {'phase' => 'query','reason' => 'all shards failed','grouped' => bless( do{\\(my $o = 1)}, 'JSON::PP::Boolean' ),'root_cause' => [{'type' => 'query_parsing_exception','reason' => 'Failed to parse query [file/Data.pm]','index' => 'cpan_v1_01'}],'type' => 'search_phase_execution_exception','failed_shards' => [{'node' => '22-yA8_3SUi3u08N540zuw','shard' => 0,'index' => 'cpan_v1_01','reason' => {'type' => 'query_parsing_exception','reason' => 'Failed to parse query [file/Data.pm]','caused_by' => {'type' => 'parse_exception','caused_by' => {'reason' => 'Lexical error at line 1, column 13.  Encountered: <EOF> after : \"/Data.pm\"','type' => 'token_mgr_error'},'reason' => 'Cannot parse \\'file/Data.pm\\': Lexical error at line 1, column 13.  Encountered: <EOF> after : \"/Data.pm\"'},'index' => 'cpan_v1_01'}}]}}}\n"
}

If the Request q=File/Data.pm was not permitted the expected behaviour would be to return an Error Response Bad Request - Status Code 400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants