Search code examples
crystal-langkemal

Unable to compile after upgrade from crystal 0.19.4 to 0.20


The shards install went well but compilation gave this error. Checked with icr that able to connect to local postgres database successfully. Any help is greatly appreciated! Thank you.

      [aranin@acbc328b9a5b:kemal-react-pg-chat-master]$ crystal build src/app.cr --release
  Error in src/app.cr:44: instantiating 'Kemal:Module#run()'

  Kemal.run
        ^~~

  in lib/kemal/src/kemal.cr:11: instantiating 'run(Nil)'

    def self.run(port = nil)
    ^

  in lib/kemal/src/kemal.cr:41: instantiating 'HTTP::Server::Context#params()'

          image = env.params.url["image"]
                      ^~~~~~

  in lib/kemal/src/kemal/context.cr:11: instantiating 'route_lookup()'

        @request.url_params ||= route_lookup.params
                                ^~~~~~~~~~~~

  in lib/kemal/src/kemal/context.cr:21: instantiating 'HTTP::Request#override_method()'

        Kemal::RouteHandler::INSTANCE.lookup_route(@request.override_method.as(String), @request.path)
                                                            ^~~~~~~~~~~~~~~

  in lib/kemal/src/kemal/request.cr:7: instantiating 'check_for_method_override!()'

      @override_method ||= check_for_method_override!
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~

  in lib/kemal/src/kemal/request.cr:14: instantiating 'Kemal::ParamParser#body()'

        params = Kemal::ParamParser.new(self).body
                                              ^~~~

  in lib/kemal/src/kemal/param_parser.cr:24: expanding macro

      {% for method in %w(url query body json) %}
      ^

  in macro 'macro_4590134368' /Users/aranin/Documents/rub-me/crystalax/kemal-react-pg-chat-master/lib/kemal/src/kemal/param_parser.cr:24, line 26:

Solution

  • It probably means that a version of kemal that targets Crystal 0.20.0 wasn't released yet. You can change your shard.yml file to point to the master branch:

    dependencies:
      kemal:
        github: sdogruyol/kemal
        branch: master
    

    That worked for me.