craft-spoon icon indicating copy to clipboard operation
craft-spoon copied to clipboard

500 on saving block settings

Open mattaebersold opened this issue 4 years ago • 13 comments

I'm trying to save tabs, but after the first successful save, it's throwing a 500 on /index.php?p=admin/actions/spoon/block-types/save every time I try to make any change now, even when backing out, and getting into the spoon settings again

Craft: 3.5.13 Spoon: 3.6.0

image image

Looks like it's trying to POST to /block-types/save every time I try to either:

  • rearrange the blocks within the tabs and save
  • before opening each block's settings

mattaebersold avatar Oct 15 '20 21:10 mattaebersold

Hey, thanks for reporting this @mattaebersold - could you send me the response output from your console as well? Or the Craft error log output - either is fine.

joshangell avatar Oct 16 '20 15:10 joshangell

@joshangell

Failed to load resource: the server responded with a status of 500 () / /index.php?p=admin/actions/spoon/block-types/save:1

The only place I see spoon in the logs is listed in HTTP_X_REGISTERED_ASSET_BUNDLES

And a pretty generic response: image

mattaebersold avatar Oct 16 '20 16:10 mattaebersold

Also, I tried dumping the yaml files in config like mentioned in the ticket about upgrading from 3.4.x to 3.5.x (since we did do that upgrade when the new 3.6.0 of spoon was released)

mattaebersold avatar Oct 16 '20 17:10 mattaebersold

Ah, did you update to 3.5 first? You will probably need to do that first, check things are saving then if they are upgrade to 3.6.

If that fixes it I’ll update the changelog and docs to flag it, didn’t think it would be an issue at first but just realised it could be!

On Fri, 16 Oct 2020 at 18:16, Matthew Aebersold [email protected] wrote:

Also, I tried dumping the yaml files in config like mentioned in the ticket about upgrading from 3.4.x to 3.5.x (since we did do that upgrade when the new 3.6.0 of spoon was released)

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/angell-co/Spoon/issues/102#issuecomment-710251849, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCV6ZCSZN7QSRLIJAB5BLSLB5YLANCNFSM4SSRHYQQ .

-- -Josh angell.io - specialist Craft CMS development and consultancy

joshangell avatar Oct 16 '20 18:10 joshangell

Hi @joshangell ,

I'm also getting the above issue when trying to save or click on the edit/cog for a component within a matrix.

The error I'm getting from the save request is:

Trying to access array offset on value of type null.

I was already on Craft 3.5 before I upgraded to Spoon 3.6.

Cheers, Harry

harrymee123 avatar Oct 20 '20 08:10 harrymee123

Update here, and a possible line on a new issue (don't know if it's related)

  • I updated to spoon 3.6 and cleared the spoonBlockTypes from the config
  • I re-set spoon configs, tabs, etc. Things seem v. stable now... but
  • a couple members of our team reported that they cannot see the tabs for blocks, just defaults to Craft's one big list. However, tabs within a block are showing up fine.
  • people who've reported it have no console issues
  • screenshot attached for reference

Everyone can see the tabs within blocks image

A few folks cannot see these tabs. Rather, it's Craft's default one list of 'blocks'. No console errors. I cannot reproduce myself image

mattaebersold avatar Oct 27 '20 21:10 mattaebersold

Hi all, thanks for your patience - I’ve been slammed the past few weeks and just catching up on things now.

I’ll see if I can reproduce it next week and then hopefully fix it!

On Tue, 27 Oct 2020 at 21:27, Matthew Aebersold [email protected] wrote:

Update here, and a possible line on a new issue (don't know if it's related)

  • I updated to spoon 3.6 and cleared the spoonBlockTypes from the config
  • I re-set spoon configs, tabs, etc. Things seem v. stable now... but
  • a couple members of our team reported that they cannot see the tabs for blocks, just defaults to Craft's one big list. However, tabs within a block are showing up fine.
  • people who've reported it have no console issues
  • screenshot attached for reference

Everyone can see the tabs within blocks [image: image] https://user-images.githubusercontent.com/435606/97363798-5829e600-1860-11eb-94a4-2c955b7e792d.png

A few folks cannot see these tabs. Rather, it's Craft's default one list of 'blocks'. No console errors. I cannot reproduce myself [image: image] https://user-images.githubusercontent.com/435606/97363841-6841c580-1860-11eb-9583-a8c8eaa4df40.png

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/angell-co/Spoon/issues/102#issuecomment-717550225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADCV65Q7JKVXJITVDF7EB3SM43L3ANCNFSM4SSRHYQQ .

-- -Josh angell.io - specialist Craft CMS development and consultancy

joshangell avatar Oct 31 '20 07:10 joshangell

We are getting the same error

{"error":"Argument 2 passed to craft\\helpers\\Db::idByUid() must be of the type string, null given, called in /app/vendor/angellco/spoon/src/services/BlockTypes.php on line 292"}l

We upgraded to Craft 3.5 and Spoon 3.6 at the same time. Seemed to be no migration issue when it was done but now running into this

john-henry avatar Dec 15 '20 00:12 john-henry

Anyone still getting this issue? I can’t reproduce it yet but if you are please do send me as much detail as you can and I will try my best to reproduce it ...

joshangell avatar Feb 09 '21 15:02 joshangell

@joshangell yeah, i often get error 500 issues trying to do most things within Spoon settings. Sometimes i just have to wait a bit longer and try again, sometimes i have to go completely out of the page and come back, and sometimes it just works... really slowly.

Same error in the logs as some of the above: Trying to access array offset on value of type null in /app/vendor/angellco/spoon/src/services/BlockTypes.php:292

michaelroper avatar May 04 '21 10:05 michaelroper

I just came across this for the first time after updating to Craft 3.7.18.2 (from a previous version of Craft 3.7) Doing anything in the Spoon settings UI results in a 500 server error:

error: "Argument 2 passed to craft\\helpers\\Db::idByUid() must be of the type string, null given, called in ../vendor/angellco/spoon/src/services/BlockTypes.php on line 292"
exception: "TypeError"
file: "../vendor/craftcms/cms/src/helpers/Db.php"
line: 909

tigerchick avatar Oct 28 '21 14:10 tigerchick

Further to my previous comment... Resaving the field Craft's own Field Settings interface seems to clear the error (do that and then go back to Spoon settings and it works correctly again)

tigerchick avatar Oct 28 '21 14:10 tigerchick

I can confirm that this is still a bug on a license of Spoon purchased and installed today, with Craft and the Spoon plug-in being both fully up to date. I can only save/edit/delete my work in Spoon about one in every five times, and that's only if I use the hack proposed by @tigerchick in the previous comment. It also wreaks havoc on my project config, somehow refreshing its config YAML whenever I change something else in the back office.

yii\base\ErrorException: Trying to access array offset on value of type null
  File "/usr/share/nginx/vendor/angellco/spoon/src/services/BlockTypes.php", line 292, in handleError
    $fieldId = Db::idByUid(Table::FIELDS, $data['field']);
  File "/usr/share/nginx/vendor/craftcms/cms/src/web/ErrorHandler.php", line 84, in handleError
    return parent::handleError($code, $message, $file, $line);
  File "/usr/share/nginx/vendor/angellco/spoon/src/services/BlockTypes.php", line 292, in handleChangedBlockType
    $fieldId = Db::idByUid(Table::FIELDS, $data['field']);
  File "/usr/share/nginx/vendor/craftcms/cms/src/services/ProjectConfig.php", line 1189, in handleChangeEvent
    $handler($event);
  File "/usr/share/nginx/vendor/craftcms/cms/src/services/ProjectConfig.php", line 0, in call_user_func
    craft\services\ProjectConfig->handleChangeEvent
...

johnfoland avatar Nov 23 '21 22:11 johnfoland