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

[BUG] Directors flagged as undefined variables #358

Open
tibbon opened this issue Sep 30, 2024 · 3 comments
Open

[BUG] Directors flagged as undefined variables #358

tibbon opened this issue Sep 30, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@tibbon
Copy link

tibbon commented Sep 30, 2024

When linting my VCL with falco (via Terraform) I'm getting this error:

🔥 [ERROR] Undefined variable "alb_main"
in main.vcl at line 358, position 21
 358|  set req.backend = alb_main;

Relevant bits of VCL:

director alb_main random {
   .quorum = 10%;
   .retries = 5;
   {
    .backend = F_alb_main_0;
    .weight  = 100;
   }
}

In both my custom vcl_recv (and in the snippet Fastly auto-inserts, i should probably de-dupe them) I have:

set req.backend = alb_main;

Expected behavior

Fastly's Director documentation says:

Like backends, directors can be assigned to req.backend, and can also be used as a backend in other directors.

so I'd expect this to be ok.

Desktop

required

  • OS: MacOS 14.6.1
  • Shell zsh
@tibbon tibbon added the bug Something isn't working label Sep 30, 2024
@tibbon
Copy link
Author

tibbon commented Sep 30, 2024

🔥 [ERROR] Function "alb_main.backend" is not defined
in main.vcl at line 358, position 25
 358 |      set req.backend = alb_main.backend();
                             ^^^^^^^^^^^^^^^^

When I try to use the .backend() function, I'm getting this error.

@tibbon
Copy link
Author

tibbon commented Sep 30, 2024

I downloaded my actual VCL file from Fastly and ran the linting, and it didn't find these errors at all. I wonder if the way my backends are being generated from VCL don't include them, and they all get squashed together via Fastly's templating.

@ysugimoto
Copy link
Owner

Hi @tibbon, thank you for reaching out to our project.

Just to confirm - Is your director will be created via Terraform using this block?

Currently we're fetch Fastly resources only backend, dictionary, acls, snippets, and logging endpoints so director won't be fetched.

I downloaded my actual VCL file from Fastly and ran the linting, and it didn't find these errors at all. I wonder if the way my backends are being generated from VCL don't include them, and they all get squashed together via Fastly's templating.

On the actual generated VCL, Fastly will generate with registered directors so probably the linting will be fine.

If true for my confirmation, we will support director to solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants