I am asking this question before I raise an issue in the hope that this a simple config problem - my simple testing has shown such fragility, it must be my end!
I've started the journey to port our CiviCRM on Drupal 7 to Drupal 9. All has gone really well (the porting guides are great) - everything basically 'works' and yesterday I got to looking at the forms. Reading, it seemed like the best approach was to just recreate the existing Drupal webforms that were integrated using webform_civicrm - this way you learn the new Webform approach and clear out the stuff the you do not need.
I created the simplest of forms by duping the template Contact form and then trying to add an 'existing contact' and a single Case to it - it immediately crashed:
The website encountered an unexpected error. Please try again later.
The log message was:
CiviCRM_API3_Exception: Expected one RelationshipType but found 0 in civicrm_api3() (line 135 of /var/www/html/vendor/civicrm/civicrm-core/api/api.php).
I've played around, using no template, using another template etc and also get other crashes at various points:
Drupal\Component\Plugin\Exception\PluginException: Plugin (webform_location_places) instance class "Drupal\webform\Plugin\WebformElement\WebformLocationPlaces" does not exist. in Drupal\Component\Plugin\Factory\DefaultFactory::getPluginClass() (line 97 of /var/www/html/web/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php).
This sort of stuff is in the logs:
Notice: Undefined index: #form_key in Drupal\webform_civicrm\Plugin\WebformElement\CivicrmContact->wf_crm_contact_fields() (line 464 of /var/www/html/web/modules/contrib/webform_civicrm/src/Plugin/WebformElement/CivicrmContact.php)
The thing is I'm not trying (yet!) to do anything tricky. On Drupal 7 I use Webform extensively to create and update cases and activities and have never seen these types of crashes. Just want to know if there is any fragility I should be aware of, or an approach where you must do X first then Y if using the integration?
Drupal 9.3.9 with CiviCRM 5.48
In the composer file (I believe as recommended):
"drupal/webform":"^6.2@beta" with "drupal/webform_civicrm": "^6.2.0" and "wikimedia/composer-merge-plugin": "^2.0"
Many thanks