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

Issue with Craft headlessMode config #68

Closed
QuentinLeclercq opened this issue May 25, 2023 · 6 comments
Closed

Issue with Craft headlessMode config #68

QuentinLeclercq opened this issue May 25, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@QuentinLeclercq
Copy link

Description

Using Craft with headlessMode creates error when saving Shopify plugin settings.

Error

PHP Warning – [yii\base\ErrorException](https://www.yiiframework.com/doc-2.0/yii-base-errorexception.html)
Undefined array key "template"
Capture d’écran 2023-05-25 à 10 45 11

Steps to reproduce

  1. In config/general.php, set headless mode to true
  2. Go to Shopify plugin settings, hit the Save button
  3. Error appears

Additional info

  • Craft version: 4.4.12
  • PHP version: 8.0.5
  • Database driver & version : MariaDB 10.11.3
  • Shopify plugin version: 3.1.1
@QuentinLeclercq QuentinLeclercq added the bug Something isn't working label May 25, 2023
@lukeholder
Copy link
Member

Looking at that error, it's coming from the old version of the plugin in your composer.json installed into your vendor directory called "shopify-product-fetcher".

Make sure you have the correct package in your composer.json

composer require craftcms/shopify -w

and remove the old one and do a

composer update

@QuentinLeclercq
Copy link
Author

QuentinLeclercq commented May 25, 2023

Hey @lukeholder, thanks for your quick answer!

Still experiencing the same issue after removing nmaier95/shopify-product-fetcher and adding/installing craftcms/shopify.

I'm not sure to understand how it can works here: https://github.com/craftcms/shopify/blob/develop/src/controllers/SettingsController.php#L67

The template key isn't sent when we enable headless mode, which is normal I guess. See the routing content in the POST request. We only have uriFormat.

image

So the Undefined array key "template" error looks like to be relevant. If I add a check on the template key like in the image below, saving works:

image

Thanks for you help!

@andrevvm
Copy link

Hi @lukeholder, I'm having the same issue as Quentin here. Even after changing the config to headlessMode(false) and reinstalling Shopify app.

Temporarily bypassing with Quentin's solution above...

@curtishenson
Copy link

Yeah this is a legitimate bug, looks like there is already a pull request to fix this as well #57

@lukeholder
Copy link
Member

Thanks everyone. I'll get a fix out shortly.

lukeholder added a commit that referenced this issue Jun 9, 2023
@lukeholder
Copy link
Member

This is now out in 3.2.0!

See the notes in the upgrading section of the README

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

4 participants