Undefined method 'opaque' for URI

#1

I just install the latest Crystal (0.28.0) on a Debian 8 64-bit system, and am having trouble compiling my sqlite db code, that was compiling with no errors on Crystal 0.27.2 on Mint 18 64-bit. Here is a greatly simplified test showing the problem:

require "uri"
puts URI.parse("mailto:alice@example.com").opaque

On Crystal 0.28.0, I get this error:

Error in uritest.cr:2: undefined method 'opaque' for URI (did you mean 'opaque?'?)

I took a look at /usr/share/crystal/src/uri.cr, and it appears to be a very old version that predates the addition of the opaque attribute.

I saw in the announcement for 0.28.0 that there were packaging problem for the 32-bit Linux version. I suspect there is some packaging problem for the 64-bit version as well.

Is there some way I can downgrade temporarily to 0.27.2 by modifying /etc/apt/sources.list.d/crystal.list?

#2

This was a breaking change in 0.28.0. See the changelog.

#3

As a way to downgrade, you can download the .deb files from github releases and manually installed.
Also docker images are available and should be easy to use.

#4

Thanks! As you can tell, I’m quite the newbie here.

I guess I’ll need to wait for the sqlite3 support to be updated, or maybe I’ll just patch it myself. Here is the line in question:

./lib/sqlite3/src/sqlite3/connection.cr:15:      uri.opaque.not_nil!

In the meantime, installing the .deb file for 0.27.2 worked fine.

#5

Yea, may take some time for libraries to be updated to support new versions. However of course when they get updated they won’t support lower crystal versions unless you install an older version of that shard.

#6

Oh, it was due to sqlite your issue.

The sqlite support is ready but not released. I will try to do it tomorrow.

#7

@bloovis the updated sqlite driver was released.

2 Likes
#8

Thank you! It’s working now.