Skip to content

vcl syntax error blocks conf:set --upload-vcl #651

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

Closed
jbartus opened this issue Jul 19, 2023 · 4 comments · Fixed by #652
Closed

vcl syntax error blocks conf:set --upload-vcl #651

jbartus opened this issue Jul 19, 2023 · 4 comments · Fixed by #652

Comments

@jbartus
Copy link

jbartus commented Jul 19, 2023

when attempting to use the cli to enable the plugin I often/sometimes get the following error:

root@jbartus-demo-origin:/var/www/magento# bin/magento fastly:conf:set --upload-vcl
Failed to validate service version: Syntax error: Expected `STRING` expression
at: (input Line 1635 Pos 38)
        !req.http.Fastly-Client-Ip ~ maint_allowlist &&
-------------------------------------###############---

which I traced to here: https://github.com/fastly/fastly-magento2/blob/master/etc/vcl_snippets/recv.vcl#L42

interestingly, on the exact same magento instance, after I get the error, I can go into the admin web interface, click the upload vcl button, and it works. so there is some subtle difference in codepaths between the cli and webui.

here is a screenshot of the fastly webui diff between the cli version that could not be activated due to the syntax error and the webui version that could:
Screenshot 2023-07-19 at 10 02 58 AM

@jbartus
Copy link
Author

jbartus commented Jul 19, 2023

thinking about it more and chatting with vlad, it seems that --upload-vcl does strictly that, and simply never creates the acl or table.

@ivanviduka
Copy link
Contributor

ivanviduka commented Jul 20, 2023

Hi @jbartus, I think that PR should solve this issue. I was able to reproduce the problem, it happens when maint_allowlist ACL doesn't exist and we try to upload the VCL. As seen in the error you received, maint_allowlist is used in recv.vcl condition and it is expected to be a STRING. Since it doesn't exist, Service validation reports error.

In Magento Admin upload, before Service validation we check if the following files exist: magentomodule_config Edge Dictionary and maint_allowlist ACL. If they don't, we create them - that is the reason why you see different result of upload which you provided in screenshot.

After this fix, CLI command should create the same VCL file after upload.

If I understood your second message correctly, you can activate your VCL from CLI command by passing additional parameter:
bin/magento fastly:conf:set --upload-vcl --activate

@vvuksan
Copy link
Contributor

vvuksan commented Jul 20, 2023

Will be part of 1.2.204

@jbartus
Copy link
Author

jbartus commented Jul 20, 2023

thank you @ivanviduka, I can confirm its fixed

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

Successfully merging a pull request may close this issue.

3 participants