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

Error with Crystal 0.35.0 ? #574

Closed
CaDs opened this issue Jun 13, 2020 · 2 comments
Closed

Error with Crystal 0.35.0 ? #574

CaDs opened this issue Jun 13, 2020 · 2 comments

Comments

@CaDs
Copy link

CaDs commented Jun 13, 2020

Description

When I run a basic Kemal app I'm getting Warning: Zlib is deprecated, use Compress::Zlib error.

Steps to Reproduce

  1. cristal init app test
  2. add kemal dependencies
name: blog
version: 0.1.0

authors:
  - xxx

targets:
  blog:
    main: src/blog.cr

crystal: 0.35.0

license: MIT

dependencies:
  kemal:
    github: kemalcr/kemal
  1. shards install
  2. crystal run src/blog.cr
  3. Warning: Zlib is deprecated, use Compress::Zlib is returned

Expected behavior: [What you expect to happen]
Kemal should start

Actual behavior: [What actually happens]
An error is risen

Reproduces how often: [What percentage of the time does it reproduce?]
Everytime

Versions

Crystal 0.35.0 (2020-06-09)

LLVM: 10.0.0
Default target: x86_64-apple-macosx

Additional Information

crystal run src/blog.cr --error-trace

Warning: Zlib is deprecated, use Compress::Zlib
In src/blog.cr:21:7

 21 | Kemal.run do |config|
            ^--
Error: instantiating 'Kemal:Module#run()'


In lib/kemal/src/kemal.cr:65:12

 65 | server.listen unless config.env == "test"
             ^-----
Error: instantiating 'HTTP::Server#listen()'


In /usr/local/Cellar/crystal/0.35.0/src/http/server.cr:455:14

 455 | @sockets.each do |socket|
                ^---
Error: instantiating 'Array(Socket::Server)#each()'


In /usr/local/Cellar/crystal/0.35.0/src/indexable.cr:187:5

 187 | each_index do |i|
       ^---------
Error: instantiating 'each_index()'


In /usr/local/Cellar/crystal/0.35.0/src/indexable.cr:187:5

 187 | each_index do |i|
       ^---------
Error: instantiating 'each_index()'


In /usr/local/Cellar/crystal/0.35.0/src/http/server.cr:455:14

 455 | @sockets.each do |socket|
                ^---
Error: instantiating 'Array(Socket::Server)#each()'


In /usr/local/Cellar/crystal/0.35.0/src/http/server.cr:468:13

 468 | spawn handle_client(_io)
       ^
Error: expanding macro


There was a problem expanding macro 'spawn'

Called macro defined in /usr/local/Cellar/crystal/0.35.0/src/concurrent.cr:99:1

 99 | macro spawn(call, *, name = nil, same_thread = false, &block)

Which expanded to:

 >  1 |
 >  2 |
 >  3 |
 >  4 |     ->(
 >  5 |
 >  6 |         __arg0 : typeof(_io),
 >  7 |
 >  8 |
 >  9 |       ) {
 > 10 |       spawn(name: nil, same_thread: false) do
 > 11 |         handle_client(
 > 12 |
 > 13 |             __arg0,
 > 14 |
 > 15 |
 > 16 |         )
 > 17 |       end
 > 18 |
 > 19 |       }.call(_io)
 > 20 |
 > 21 |
Error: instantiating 'handle_client(IO+)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server.cr:513:16

 513 | @processor.process(io, io)
                  ^------
Error: instantiating 'HTTP::Server::RequestProcessor#process(IO+, IO+)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/request_processor.cr:50:20

 50 | @handler.call(context)
               ^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handlers/compress_handler.cr:12:5

 12 | {% if flag?(:without_zlib) %}
      ^
Error: expanding macro


There was a problem expanding macro 'macro_4775098448'

Called macro defined in /usr/local/Cellar/crystal/0.35.0/src/http/server/handlers/compress_handler.cr:12:5

 12 | {% if flag?(:without_zlib) %}

Which expanded to:

 >  1 |
 >  2 |       request_headers = context.request.headers
 >  3 |
 >  4 |       if request_headers.includes_word?("Accept-Encoding", "gzip")
 >  5 |         context.response.headers["Content-Encoding"] = "gzip"
 >  6 |         context.response.output = Compress::Gzip::Writer.new(context.response.output, sync_close: true)
 >  7 |       elsif request_headers.includes_word?("Accept-Encoding", "deflate")
 >  8 |         context.response.headers["Content-Encoding"] = "deflate"
 >  9 |         context.response.output = Compress::Deflate::Writer.new(context.response.output, sync_close: true)
 > 10 |       end
 > 11 |
 > 12 |       call_next(context)
 > 13 |
Error: instantiating 'call_next(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handler.cr:28:20

 28 | next_handler.call(context)
                   ^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handlers/error_handler.cr:17:7

 17 | call_next(context)
      ^--------
Error: instantiating 'call_next(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handler.cr:28:20

 28 | next_handler.call(context)
                   ^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handlers/log_handler.cr:20:7

 20 | call_next(context)
      ^--------
Error: instantiating 'call_next(HTTP::Server::Context)'


In /usr/local/Cellar/crystal/0.35.0/src/http/server/handler.cr:28:20

 28 | next_handler.call(context)
                   ^---
Error: instantiating '(HTTP::Handler | Proc(HTTP::Server::Context, Nil))#call(HTTP::Server::Context)'


In lib/kemal/src/kemal/static_file_handler.cr:66:9

 66 | send_file(context, file_path)
      ^--------
Error: instantiating 'send_file(HTTP::Server::Context, String)'


In lib/kemal/src/kemal/helpers/helpers.cr:135:8

 135 | File.open(file_path) do |file|
            ^---
Error: instantiating 'File.class#open(String)'


In lib/kemal/src/kemal/helpers/helpers.cr:135:8

 135 | File.open(file_path) do |file|
            ^---
Error: instantiating 'File.class#open(String)'


In lib/kemal/src/kemal/helpers/helpers.cr:143:7

 143 | Gzip::Writer.open(env.response) do |deflate|
       ^
Error: undefined constant Gzip::Writer
@Blacksmoke16
Copy link
Contributor

Duplicate of:

Fixed by #570, just waiting on a new release. Can use branch, or commit options as mentioned in #572.

@CaDs
Copy link
Author

CaDs commented Jun 13, 2020

Thanks

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

No branches or pull requests

2 participants