I am copying some VCL rules from this handy template and running on the latest stable Varnish4. However this section of the VCL:
vcl 4.0;
sub vcl_init {
# ...
# Normalize query arguments
set req.url = std.querysort(req.url);
}
^
Returns this error:
-- Logs begin at Tue 2016-03-15 10:44:31 UTC, end at Tue 2016-03-15 13:02:10 UTC. --
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: Message from VCC-compiler:
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: Symbol not found: 'std.querysort' (expected type STRING_LIST):
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: ('/etc/varnish/test.vcl' Line 55 Pos 23)
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: set req.url = std.querysort(req.url);
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: ----------------------#############----------
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: Running VCC-compiler failed, exited with 2
Mar 15 13:02:10 ip-172-31-10-46 reload-vcl[18044]: VCL compilation failed
Should I include a mod or define std
somehow?
Yes! I stumbled on the answer inside another answer. Adding import std;
at the top of the script stopped the error.
vcl 4.0;
import std;
sub vcl_init {
# ...
# Normalize query arguments
set req.url = std.querysort(req.url);
}