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

[ECP-8713] Building assets of Administration and Storefront without a Database #430

Closed
wannevancamp opened this issue Oct 30, 2023 · 8 comments · Fixed by #439
Closed

[ECP-8713] Building assets of Administration and Storefront without a Database #430

wannevancamp opened this issue Oct 30, 2023 · 8 comments · Fixed by #439

Comments

@wannevancamp
Copy link
Contributor

wannevancamp commented Oct 30, 2023

Describe the bug
It is common to prebuild assets in professional deployments to deploy the build artefact assets to the production environment. This task is mostly done by a CI job that doesn't have access to the production database.
Shopware has foreseen a config for this: https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/build-w-o-db.html

Plugins can be compiled in the CI and be synced to the production server without a database or even a working Symfony Container.

This plugin builds assets when the container builds and therefore can't be used in CI builds without a database or Symfony Container.

public function build(ContainerBuilder $container): void
    {
        parent::build($container);
        $this->installJsAssets($container->getParameter('kernel.shopware_version'));
    }

Because the assets doesn't exist in the production environment the following error is thrown:

Warning: copy(/.../.../.../vendor/store.shopware.com/adyenpaymentshopware6/src/Resources/public/administration/js/adyen-payment-shopware64.js.dist): Failed to open stream: No such file or directory

Versions
Shopware version: all versions
Plugin version: all versions

To Reproduce
Steps to reproduce the behavior:

  1. Install plugin
  2. Setup build CI without a database: https://developer.shopware.com/docs/guides/hosting/installation-updates/deployments/build-w-o-db.html
  3. Open frontend
  4. See error

Expected behavior
Assets should be compiled beforehand or when using the bin/build-storefront.js and bin/build-administration.js

@peterojo
Copy link
Contributor

Hi @wannevancamp!
Thanks for bringing this to our attention! We'll investigate this option and decide on the best way to make it easier for the majority of the plugin users.

@candemiralp candemiralp changed the title Building assets of Administration and Storefront without a Database [ECP-8713] Building assets of Administration and Storefront without a Database Oct 31, 2023
@wannevancamp
Copy link
Contributor Author

@peterojo, meanwhile we did some more research. The issue is actually not related to the build process without database. We can reproduce this in all our environments. It is actually a bigger issue than first thought because the plugin can't be used anyway.

Steps to reproduce

  1. Install plugin via composer
  2. run composer install (at this point the following files exists)
  • src/Resources/public/administration/js/adyen-payment-shopware64.js.dist
  • src/Resources/public/administration/js/adyen-payment-shopware645.js.dist
  1. build the administration bin/build-administration.sh (at this point the following files exists do NOT exists anymore)
  • src/Resources/public/administration/js/adyen-payment-shopware64.js.dist
  • src/Resources/public/administration/js/adyen-payment-shopware645.js.dist
  1. remove the cache rm -rf var/cache/*
  2. visit a page (at the point the Symfony container will build by src/AdyenPaymentShopware6.php:installJsAssets and an error is thrown)
Warning: copy(/.../.../.../vendor/store.shopware.com/adyenpaymentshopware6/src/Resources/public/administration/js/adyen-payment-shopware64.js.dist): Failed to open stream: No such file or directory

Solution
You could maybe switch to esbuild and https://www.npmjs.com/package/@friendsofshopware/storefront-sdk so you can release the same version for both Shopware versions.

@sneakyvv
Copy link
Contributor

This means the plugin is simply NOT working on SW 6.5

Can we bump the priority on this?

@MelvinAchterhuis
Copy link
Contributor

We don't have this problem in our SW6.5 installation but we don't require it from store.shopware.com/adyenpaymentshopware6, but use adyen/adyen-shopware6

@wannevancamp
Copy link
Contributor Author

@MelvinAchterhuis , I've just verified. The issue occurs with both versions.
Did you run bin/build-administration.sh and cleared the cache (rm -rf var/cache/) afterwards?

@wannevancamp
Copy link
Contributor Author

wannevancamp commented Nov 29, 2023

@peterojo, meanwhile I found why some merchants experience this issue and others do not.
This issue only occurs between the following Shopware versions 6.5.1.0 - 6.5.4.0.
Besides that, this can be fixed for those versions. The compatibility should be updated so that merchants know that the extension is not compatible with some versions: https://store.shopware.com/en/adyen70424242359f/adyen-payments-for-shopware-6.html

If there are no plans to fix this issue for those versions, this issue can be closed.

Some references:

@peterojo
Copy link
Contributor

@wannevancamp thanks for your insights! we will consider whether we can fix this in a way that works either way, if not we will update the supported versions in the marketplace

@peterojo
Copy link
Contributor

peterojo commented Dec 6, 2023

Hi all!
Adding a fix in #439 to fail safely if the copy process is not possible.
Note that the plugin already ships with the generated files for Shopware 6.5, so that running the build-*.sh command should not be necessary for the plugin assets to work.

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.

4 participants