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

Error when importing Bard field in imported fieldset #17

Open
stephenmeehanuk opened this issue Oct 30, 2024 · 8 comments · Fixed by #22
Open

Error when importing Bard field in imported fieldset #17

stephenmeehanuk opened this issue Oct 30, 2024 · 8 comments · Fixed by #22
Labels
bug Something isn't working

Comments

@stephenmeehanuk
Copy link

stephenmeehanuk commented Oct 30, 2024

Bug description

I've created a blueprint that's using a prefixed bard fieldset. When I try to import I get this error

local.ERROR: Undefined array key "resources_bard_basic"

I've removed the prefix, still using a fieldset and I get a similar error

local.ERROR: Undefined array key "bard_basic"

However, if I don't use a fieldset, just a regualr bard fieldtype... it works.

Other fieldsets, like my author works.

How to reproduce

  • Use a bard fieldset in a blueprint
  • Try to import content into that
  • local.ERROR: Undefined array key

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.29.0
PHP Version: 8.3.8
Composer Version: 2.6.5
Environment: local
Debug Mode: OFF
URL: vocal.test
Maintenance Mode: OFF
Timezone: Europe/London
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: redis
Session: file

Statamic
Addons: 3
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: Disabled
Version: 5.35.0 PRO

Statamic Addons
jonassiewertsen/statamic-jobs: 1.5.0
statamic/importer: 1.0.2
visuellverstehen/statamic-anchor-navigation: 1.0.0

Additional details

No response

@stephenmeehanuk stephenmeehanuk added the bug Something isn't working label Oct 30, 2024
@duncanmcclean
Copy link
Member

Are you able to provide the full stack trace for that error?

@stephenmeehanuk
Copy link
Author

stephenmeehanuk commented Oct 30, 2024

[2024-10-30 13:03:52] local.ERROR: Undefined array key "bard_basic" {"exception":"[object] (ErrorException(code: 0): Undefined array key \"bard_basic\" at /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Collections/Collection.php:1882)
[stacktrace]
#0 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(256): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'Undefined array...', '/Users/stephenm...', 1882)
#1 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(1882): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'Undefined array...', '/Users/stephenm...', 1882)
#2 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/cms/src/Fields/Blueprint.php(631): Illuminate\\Support\\Collection->offsetGet('bard_basic')
#3 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/cms/src/Fields/Blueprint.php(560): Statamic\\Fields\\Blueprint->ensureFieldInTabHasConfig('bard_basic', 'main', Array)
#4 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/importer/src/Transformers/BardTransformer.php(59): Statamic\\Fields\\Blueprint->ensureFieldHasConfig('bard_basic', Array)
#5 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/importer/src/Transformers/BardTransformer.php(15): Statamic\\Importer\\Transformers\\BardTransformer->enableBardButtons()
#6 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/importer/src/Jobs/ImportItemJob.php(41): Statamic\\Importer\\Transformers\\BardTransformer->transform('We bring patien...')
#7 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Collections/Arr.php(632): Statamic\\Importer\\Jobs\\ImportItemJob->Statamic\\Importer\\Jobs\\{closure}(Array, 'bard_basic')
#8 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Collections/Collection.php(839): Illuminate\\Support\\Arr::mapWithKeys(Array, Object(Closure))
#9 /Users/stephenmeehan/Repositories/vocal/vendor/statamic/importer/src/Jobs/ImportItemJob.php(32): Illuminate\\Support\\Collection->mapWithKeys(Object(Closure))
#10 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Statamic\\Importer\\Jobs\\ImportItemJob->handle()
#11 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#12 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#13 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#14 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#15 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call(Array)
#16 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}(Object(Statamic\\Importer\\Jobs\\ImportItemJob))
#17 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Statamic\\Importer\\Jobs\\ImportItemJob))
#18 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#19 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\\Bus\\Dispatcher->dispatchNow(Object(Statamic\\Importer\\Jobs\\ImportItemJob), false)
#20 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}(Object(Statamic\\Importer\\Jobs\\ImportItemJob))
#21 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Statamic\\Importer\\Jobs\\ImportItemJob))
#22 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#23 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\\Queue\\Jobs\\RedisJob), Object(Statamic\\Importer\\Jobs\\ImportItemJob))
#24 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call(Object(Illuminate\\Queue\\Jobs\\RedisJob), Array)
#25 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(440): Illuminate\\Queue\\Jobs\\Job->fire()
#26 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(390): Illuminate\\Queue\\Worker->process('redis', Object(Illuminate\\Queue\\Jobs\\RedisJob), Object(Illuminate\\Queue\\WorkerOptions))
#27 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(334): Illuminate\\Queue\\Worker->runJob(Object(Illuminate\\Queue\\Jobs\\RedisJob), 'redis', Object(Illuminate\\Queue\\WorkerOptions))
#28 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(141): Illuminate\\Queue\\Worker->runNextJob('redis', 'default', Object(Illuminate\\Queue\\WorkerOptions))
#29 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(124): Illuminate\\Queue\\Console\\WorkCommand->runWorker('redis', 'default')
#30 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#31 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#32 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#33 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#34 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Container/Container.php(690): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL)
#35 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\\Container\\Container->call(Array)
#36 /Users/stephenmeehan/Repositories/vocal/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#37 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#38 /Users/stephenmeehan/Repositories/vocal/vendor/symfony/console/Application.php(1047): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#39 /Users/stephenmeehan/Repositories/vocal/vendor/symfony/console/Application.php(316): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Queue\\Console\\WorkCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#40 /Users/stephenmeehan/Repositories/vocal/vendor/symfony/console/Application.php(167): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#41 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#42 /Users/stephenmeehan/Repositories/vocal/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1203): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#43 /Users/stephenmeehan/Repositories/vocal/artisan(13): Illuminate\\Foundation\\Application->handleCommand(Object(Symfony\\Component\\Console\\Input\\ArgvInput))
#44 {main}
"} 

@duncanmcclean
Copy link
Member

Thanks!

@duncanmcclean duncanmcclean changed the title Undefined array key Error when importing Bard field in imported fieldset Oct 30, 2024
@stephenmeehanuk
Copy link
Author

I'm still seeing this issue in 1.4.1

@duncanmcclean
Copy link
Member

The fix was released in 1.5.0, which was released an hour or so ago.

@stephenmeehanuk
Copy link
Author

Got it. Just updated, thanks for this.

A prefixed bard fieldset now works... But a nested bard fieldset doens't work.

@stephenmeehanuk
Copy link
Author

Inside this hero fieldset, I've got bard fieldset.
Screenshot 2024-11-29 at 14 49 31

That has a prefix of hero_
Screenshot 2024-11-29 at 14 50 36

@duncanmcclean
Copy link
Member

Ah, nested fieldsets. 🙈

@duncanmcclean duncanmcclean reopened this Nov 29, 2024
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

Successfully merging a pull request may close this issue.

2 participants