Index of every page on this site: llms.txt
All skills
grasmash avatar

/drupal-canvas-sdc

@19514f4
Run it yourself

Drupal Canvas SDC (Single Directory Components) with Twig templates. Use when creating, modifying, or troubleshooting Twig-based Canvas components in themes/modules, component.yml schemas, Canvas registration (props need title, required props need examples), canvas.component config entities, component versioning and outdated instances, config drift after a Canvas upgrade, Canvas preview issues, or page builder functionality. For React/JSX Code Components, see the upstream drupal-canvas/skills suite.

Use this Skill: https://skilld.dev/gh/grasmash/drupal-claude-skills/drupal-canvas-sdc

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestroubleshooting-version-mismatches.md

≈897 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Troubleshooting: Component Version Mismatches (500 Errors)

Diagnosing and recovering from the "is not a prop on this version of the Component" 500 error. canvas:upgrade-instances and canvas:component-info below are project-custom Drush commands, not shipped by Canvas; see component-versioning.md.

Symptom

Canvas editor throws 500: 'propName' is not a prop on this version of the Component 'Code component: ComponentName'

Root Cause

The Canvas component entity's active_version was generated from an older build of the component that didn't include the prop. The source component.yml has the prop, but the deployed Canvas entity doesn't.

Key distinction by component type:

  • SDC components (sdc.*): Canvas regenerates versions on drush cr from the source component.yml
  • JS code components (js.*): Canvas versions are set when the component is uploaded via CLI. drush cr alone does NOT update them.

Recovery Steps

For JS Code Components (js.*)
# 1. Re-upload the component to generate a new version from source component.yml
npx canvas upload --components container -y

# 2. Upgrade existing instances to the new active version
ddev drush canvas:upgrade-instances js.container -y

# 3. Verify
ddev drush canvas:component-info js.container

The upload command is configured via .env in the canvas-components project:

  • CANVAS_SITE_URL=http://example.ddev.site
  • CANVAS_CLIENT_ID=canvas_cli
  • CANVAS_CLIENT_SECRET=<your-client-secret>
For SDC Components (sdc.*)
# 1. Clear cache to trigger re-discovery from source
ddev drush cr

# 2. Upgrade existing instances
ddev drush canvas:upgrade-instances sdc.mytheme.component-name -y

# 3. Export only the updated config entity (use your config sync directory)
ddev drush config:get canvas.component.sdc.mytheme.component-name --format=yaml \
  > config/sync/canvas.component.sdc.mytheme.component-name.yml

Diagnosis Commands

# Check what props the active version has
ddev drush ev "\$c = \Drupal::entityTypeManager()->getStorage('component')->load('js.container'); echo implode(', ', array_keys(\$c->get('versioned_properties')['active']['settings']['prop_field_definitions'] ?? []));"

# Check what version/inputs an instance has on a specific page
ddev drush ev "\$p = \Drupal::entityTypeManager()->getStorage('canvas_page')->load(6); foreach (\$p->toArray()['components'] ?? [] as \$c) { if (\$c['component_id'] === 'js.container') echo \$c['component_version'] . ': ' . \$c['inputs']; }"

# Compare: does the instance version match the active version?
ddev drush canvas:upgrade-instances  # Lists all mismatches

Stale Auto-Saves

Canvas auto-saves can reference old component versions. If a 500 persists after upgrading instances, check for and delete stale auto-saves:

# Check pending auto-saves
curl -s -b /tmp/cookies.txt "https://example.ddev.site/canvas/api/v0/auto-saves/pending"

# Delete a stale auto-save (need CSRF token)
CSRF=$(curl -s -b /tmp/cookies.txt "https://example.ddev.site/session/token")
curl -s -b /tmp/cookies.txt -X DELETE -H "X-CSRF-Token: $CSRF" \
  "https://example.ddev.site/canvas/api/v0/auto-saves/canvas_page/{PAGE_ID}"

Prevention

After modifying any component's component.yml props:

  1. JS components: npx canvas upload --components <name> -y
  2. SDC components: ddev drush cr
  3. Always: ddev drush canvas:upgrade-instances to check for stale instances
  4. Always: Test the Canvas editor page before pushing

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The skill provides instructional documentation and utility scripts for Drupal developers using the Canvas module and Single Directory Components (SDC). No malicious patterns were detected.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at 19514f4. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Steadyupdated 2 months ago

README badge

README badge for grasmash/drupal-claude-skills/drupal-canvas-sdc