Skip to content

Fastly module breaks interface contract #466

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
ihor-sviziev opened this issue Jul 20, 2021 · 6 comments
Closed

Fastly module breaks interface contract #466

ihor-sviziev opened this issue Jul 20, 2021 · 6 comments

Comments

@ihor-sviziev
Copy link

ihor-sviziev commented Jul 20, 2021

Hi,

This is follow up to the magento/magento2#33468 (comment)

Pre-history: In Magento at some point was delivered a fix for incorrect return type for \Magento\PageCache\Model\Config::getType() in magento/magento2@b59dc72#diff-1281464bcdc813265cb8b0e9822464bd0504743ca81e31b00d46a8b600c9b770R124

Later on, as Magento Cloud using Fastly as CDN provider, this change was partly reverted in magento/magento2@1778c0f, which caused another issue - more details see in magento/magento2#33468.

Root cause analysis shown, that issue coming to the Fastly extension, as it introduced value "fastly" (string) for the method "getType", then converting it to integer (as method designed to return integer) just breaks Fastly extension.

if ($this->config->getType() == Config::FASTLY && $this->config->isEnabled()) {

const FASTLY = 'fastly';

Suggestion:

  1. Change "type" from "fastly" to some integer value
  2. Write a data upgrade script that will convert the old value to new one.

/CC @hostep

@ihor-sviziev
Copy link
Author

@vvuksan, could you review this issue?

@dpotkoc
Copy link
Contributor

dpotkoc commented Jul 21, 2021

Hello @ihor-sviziev we are aware of issue and we are fine with your suggestion.

If we change "type" from "fastly" to some integer, which value is fine?

Magento is using next values:
const BUILT_IN = 1;
const VARNISH = 2;

I mean that we should use some number greater then 3, because Magento can use 3 for some other type of cache and then we will have issue / conflict.

What do you mean?

Thnx
Domagoj

@ihor-sviziev
Copy link
Author

@dpotkoc, I think you can use some value greater than 10, maybe 100 is good enough.

@dpotkoc
Copy link
Contributor

dpotkoc commented Jul 21, 2021

@ihor-sviziev thnx for answer, we will make modification.

Domagoj

dpotkoc added a commit to favicode/fastly-magento2 that referenced this issue Jul 28, 2021
dpotkoc added a commit to favicode/fastly-magento2 that referenced this issue Jul 28, 2021
dpotkoc added a commit to favicode/fastly-magento2 that referenced this issue Jul 29, 2021
@dpotkoc dpotkoc mentioned this issue Aug 2, 2021
@vvuksan vvuksan closed this as completed in e45c6f1 Aug 3, 2021
@IgorVitol
Copy link

IgorVitol commented Aug 17, 2021

@ihor-sviziev @dpotkoc @vvuksan Updated fastly extension today and noted that it is no longer backward compatible. Our cloud stage env for some reason switched back to Built-in cache. Root cause is because of "fastly" was changed to "42".

Even with this, seems like image optimizations stopped to work:

if ($this->_scopeConfig->getValue(PageCacheConfig::XML_PAGECACHE_TYPE) !== Config::FASTLY) {
// ...
}

Such block doesn't work properly, since "42" !== 42 is true.

As a temporary solution we have to downgrade back, to the older version.

@dpotkoc
Copy link
Contributor

dpotkoc commented Aug 17, 2021

Hello @IgorVitol thnx for reporting, we will need to fix issue for image processing. I agree with you.

Regarding your claim "Our cloud stage env for some reason switched back to Built-in cache. Root cause is because of "fastly" was changed to "42"."
It will be good if you can send us steps how to reproduce.

I think that Fastly worked fine but you had old value "fastly" exported in config.php file and dropdown in Magento admin section was not be able to preselect right option with fastly cache.

If you exported config to files we can't change file on your disc

We have plugin which is fixing issue if you have old vaule in config:

public function aroundGetType(Config $config, callable $proceed)

Thnx
Domagoj

MickaelDatadome pushed a commit to DataDome/fastly-magento2 that referenced this issue Oct 5, 2023
MickaelDatadome pushed a commit to DataDome/fastly-magento2 that referenced this issue Oct 5, 2023
MickaelDatadome pushed a commit to DataDome/fastly-magento2 that referenced this issue Oct 5, 2023
MickaelDatadome pushed a commit to DataDome/fastly-magento2 that referenced this issue Oct 5, 2023
MickaelDatadome added a commit to DataDome/fastly-magento2 that referenced this issue Oct 5, 2023
Co-authored-by: Shohei Maeda <[email protected]>
Co-authored-by: Domagoj Potkoc <[email protected]>
Co-authored-by: kirgiv4oja <[email protected]>
Co-authored-by: Vladimir Vuksan <[email protected]>
Co-authored-by: Pawel Siejba <[email protected]>
Co-authored-by: Andrew Kett <[email protected]>
Co-authored-by: Peter Dohogne <[email protected]>
Co-authored-by: Lex <[email protected]>
Co-authored-by: Dan Wallis <[email protected]>
Co-authored-by: Sean <[email protected]>
Co-authored-by: Domagoj Potkoc <[email protected]>
Co-authored-by: Jack Scotson <[email protected]>
Co-authored-by: Bohdan Korablov <[email protected]>
Co-authored-by: github-actions <smaeda-ks [email protected]>
Co-authored-by: Alejandro Marroni <[email protected]>
Co-authored-by: github-actions <vvuksan [email protected]>
Co-authored-by: Vladimir Vuksan <[email protected]>
Co-authored-by: Joao Oliveira Pereira <[email protected]>
Co-authored-by: Borna Butkovic <[email protected]>
Co-authored-by: Frangolacci Sebastien <[email protected]>
Co-authored-by: Borzas Laszlo <[email protected]>
Co-authored-by: mizdebski-netacea <[email protected]>
Co-authored-by: Pawel Siejba <[email protected]>
Co-authored-by: ivanviduka <[email protected]>
Co-authored-by: Lauredg <[email protected]>
Co-authored-by: Lauredg <[email protected]>
Fix unset req.http.graphql
fix typo (fastly#464)
fix Fastly const value ti int value fastly#466
fix plugin annotation fastly#466
fix fastly#466
fixing old value in core_config_data fastly#466
fix type check in Image (fastly#472)
fix config save - image optimization fastly#476
Fix ambiguous behavior in Blocking toggle (fastly#479)
Fix type check (fastly#483)
Fix bugs in upadte backend dialog (fastly#487)
Fix for: GetUpdateFlag call flushes all configuration fastly#499
Fix for fastly#504
fix for fastly#520
fixing duplicate line reported under issue#518
Fix fastly#393
fix fastly#393
Fix javascript fastly#544
fix fastly#551
fix getImageOptimization - Deprecated Functionality: explode(): Passing null to parameter #2
fix for fastly#549 as submitted by customer
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