Crossplane "crossplane beta validate" error in CI
crossplane beta validate renders your resources and checks each one against the CRD schemas of the providers and XRDs you point it at. A non-zero exit means at least one resource violates a schema, so the PR check fails before anything is applied.
What this error means
A PR step running crossplane beta validate exits non-zero and prints one or more "schema validation error" lines naming the resource and the offending field.
[x] schema validation error: apiextensions.crossplane.io/v1, Kind=Composition,
example-composition : spec.resources[0].base.spec.forProvider.region:
Invalid value: "null": spec.resources[0].base.spec.forProvider.region in body must be of type stringCommon causes
A rendered resource violates the provider CRD schema
A required field is missing, has the wrong type, or uses a value the provider CRD rejects, so validation fails against the extracted schemas.
Validating against stale or incomplete schemas
The schema source (a directory of CRDs or extracted provider packages) does not include every CRD the resources reference, so validation cannot confirm them.
How to fix it
Validate against the real provider CRDs
- Point validate at a directory containing the provider and XRD CRDs plus your composition.
- Read the field path in the error and correct the base resource.
- Re-run validate until it exits zero.
crossplane beta validate ./crds ./composition.yamlFix the field the error names
Set the required field with a real value (or a patch) so the rendered resource satisfies the CRD schema.
- name: bucket
base:
apiVersion: s3.aws.upbound.io/v1beta1
kind: Bucket
spec:
forProvider:
region: us-east-1How to prevent it
- Run
crossplane beta validateon every PR that touches compositions. - Keep the CRD set you validate against in sync with the providers you deploy.
- Treat validation failures as blocking so bad schemas never reach the cluster.