craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 626 forks source link

[4.x]: Plugin license keys don't match tracked keys after going through Craft Console checkout process #14085

Closed turnstylerj closed 8 months ago

turnstylerj commented 8 months ago

What happened?

Description

We've noticed on a couple of projects that when launching a site and having a client click the "Resolve now" button in production to purchase a Craft CMS Pro license along with a handful of plugin licenses, that after they go through the process of connecting their Craft Console account and paying for the licenses, once I clear data caches, the CMS shows as licensed but the plugins don't. On further investigation, the license keys that show up in their Craft Console account they paid for seem to be new and don't match the keys we have tracked in project config/live in the db.

Steps to reproduce

  1. Set a new site with unlicensed plugins to "production" environment
  2. Pay for the plugins by clicking the "Resolve now" banner and connecting your Craft Console account
  3. Clear data caches

Expected behavior

Banner to pay for licenses goes away.

Actual behavior

Banner stays, keys paid for don't match tracked keys in project config.

Craft CMS version

4.5.12

PHP version

8.2.11

Operating system and version

Linux 5.15.68-0-virt

Database type and version

MariaDB 10.4.31

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

"craftcms/ckeditor": "3.6.0", "doublesecretagency/craft-cpcss": "^2.6", "internetztube/craft-element-relations": "^2.0", "mmikkel/retcon": "2.7.5", "nystudio107/craft-imageoptimize": "4.0.5", "nystudio107/craft-retour": "4.1.14", "nystudio107/craft-seomatic": "4.0.37", "percipioglobal/craft-colour-swatches": "4.3.0", "servd/craft-asset-storage": "3.5.6", "spicyweb/craft-neo": "3.9.11", "vaersaagod/matrixmate": "2.1.4", "verbb/field-manager": "3.0.8", "verbb/image-resizer": "3.0.9", "vlucas/phpdotenv": "^5.4.0"

brandonkelly commented 8 months ago

I just tested this and it worked as expected. The purchased licenses have the same key they started with, and Craft now sees them as valid licenses.

that after they go through the process of connecting their Craft Console account and paying for the licenses

What exactly do you mean by “connecting their Craft Console account”? Just logging in? Or was a new Console account created in the process? (There is no active connection between Craft CMS and Craft Console.)

angelokeirsebilck commented 8 months ago

I've had the same issue before on all projects lately.

We buy the license keys through the CP but the keys for the plugins don't match the ones that are checked into git and on the live site. Then we have to manually copy the keys from the craft console to the plugin settings in our local env -> push and pull again on live.

turnstylerj commented 8 months ago

I just tested this and it worked as expected. The purchased licenses have the same key they started with, and Craft now sees them as valid licenses.

that after they go through the process of connecting their Craft Console account and paying for the licenses

What exactly do you mean by “connecting their Craft Console account”? Just logging in? Or was a new Console account created in the process? (There is no active connection between Craft CMS and Craft Console.)

Yeah, I just mean logging in to their console account through the CMS to pay for the licenses. It's behaving as if new licenses are being generated for all the plugins at that point.

I don't know if it's relevant (or if @angelokeirsebilck is in the same boat), but FWIW the projects we've noticed this on are hosted on Servd. I only mention this because we've had issues with their ephemeral environments and Craft in the past.

angelokeirsebilck commented 8 months ago

I don't know if it's relevant (or if @angelokeirsebilck is in the same boat), but FWIW the projects we've noticed this on are hosted on Servd. I only mention this because we've had issues with their ephemeral environments and Craft in the past.

Nope, not using Served. I've had the same problem on different hosting providers.

It is like you describe. When buying licences through the CP for both Craft and the plugins installed. The plugin licences/keys are not connected to the Craft Pro license because it generates new plugin licences/keys and did not use the keys from the CP.

So afterwards we have to copy the plugin keys from craft console and fill them in the in the plugin settings on our local env and pull back on live env.

brandonkelly commented 8 months ago

Which link are you pressing to get to Console? The “Resolve now” button within the Licensing Issues nag alert? The link in the footer? Something else?

angelokeirsebilck commented 8 months ago

Which link are you pressing to get to Console? The “Resolve now” button within the Licensing Issues nag alert? The link in the footer? Something else?

The resolve now button in the header.

brandonkelly commented 8 months ago

Check your Git history. At the time you pressed it, were the plugin license keys present in config/project/project.yaml (under plugins)?

turnstylerj commented 8 months ago

Check your Git history. At the time you pressed it, were the plugin license keys present in config/project/project.yaml (under plugins)?

I double checked this time since it happened before and can confirm prior to the client purchasing licenses, the keys matched in the DB and in project.yaml for us.

angrybrad commented 8 months ago

@turnstylerj @angelokeirsebilck can either of you send over some details to support@craftcms.com so we can try to track this down?

Specifically:

jrrdnx commented 8 months ago

I just ran into this issue and sent an email to support@craftcms.com, and right after sending noticed that the purchased plugin license keys do NOT match what I have saved in the .env file.

The project config references these variables like licenseKey: $SEOMATIC_LICENSE_KEY and I've verified that what's saved in .env hasn't changed (license keys are identical across local, dev, staging, and production environments). So somewhere between clicking the 'Resolve now' button in the nag alert and completing the purchase the plugin license keys were changed.

I've updated the license keys listed in the .env to match what was purchased.

timkelty commented 8 months ago

This should now be resolved!

It occurred when the renewal duration or auto-renew options were altered for a line item for an existing license. Thanks to everyone for the report and details!