Updating schema does not update Fauna

I have been trying to update the schema on fauna for a couple of days now. There are no errors that pop up and fauna says that the update is successful but it’s not. After updating, I checked the modified fields and they are still the same as before I tried updating. I’ve seen this issue before and the way I fixed it was to just overwrite the schema, but I can’t do that now. I have Live data on the system and can only modify it.

I have seen other topics on here with similar issues, and I have tried resolving my issue the same way those topics resolved their issues. But nothing seems to work.

The schema I’m trying to upload:

type System {
	newest_order: Int
	month: String @unique
	orders: [Order] @relation

type Order {
	version: String
	created_at: Time @required
	order_id: String
	order_source: String
	po_number: String
	customer_notes: String
	internal_notes: String
	status: String @required
	stage: String
	sendTo: String
	printed: Boolean
	product_string: String

	buyer: Buyer @relation
	recipient: Recipient @required
	package: Package
	shipment: Shipment
	products: [Product] @required
	payment: Payment
	order_history: System @relation

type Buyer {
	type: String
	email: String! @unique
	first_name: String
	last_name: String
	company: String

	orders: [Order] @relation

type Recipient @embedded {
	pick_up: Boolean
	first_name: String @required
	last_name: String @required
	address_1: String @required
	address_2: String
	city: String @required
	state: String @required
	zip: String @required
	full_string: String
type Package @embedded {
	width: Float
	height: Float
	length: Float
	pounds: Float
	ounces: Float
type Shipment @embedded {
	status: String
	shipengine: ShipEngine
type ShipEngine @embedded {
	cost: Float
	shipment_id: String
	label_id: String
	service_code: String
	tracking_number: String
	object: String
	verified: Boolean
	verifiedIssue: Boolean

	label_download: Label
	rates: [Rate]
type Label @embedded {
	pdf: String
	png: String
	zpl: String
	href: String
type Rate @embedded {
	rate_id: String
	rate_type: String
	carrier_id: String
	shipping_amount: Amount
	insurance_amount: Amount
	confirmation_amount: Amount
	other_amount: Amount
	package_type: String
	ship_date: Time
	service_type: String
	service_code: String
	trackable: Boolean
	carrier_code: String
	carrier_nickname: String
	carrier_friendly_name: String
	validation_status: String
type Amount @embedded {
	currency: String
	amount: Float
type Product @embedded {
	quantity: Int @required
	status: String
	sku: String
	description: String
	image_url: String
	image_url_thumbnail: String
	image_url_medium: String
	image_url_large: String
	image_type: String
	image_id: String
type Payment @embedded {
	type: String
	status: String

# Users including admins, and dropshippers
type User {
	created_at: Time @required
	type: String # dropshipper, admin, staff, production, shipping, invoicing, etc.
	#permissions: [Permissions]
	#code: String @required
	email: String @required
	first_name: String
	last_name: String
	company: String
	#auth_token: String

What do you mean? That you expect the documents to change and they are not, or when you inspect the graphql docs in playground you can see that the Schema didn’t take?

What parts of the schema are you trying to change?


So after looking at your schema, I noticed you are using a @required directive, but that’s not something that exists. So you might want to change that first before messing around with collection metadata like I wrote below.

There’s no @required directive. To make a field required you use the ! mark like:

type Recipient @embedded {
	pick_up: Boolean
	first_name: String!
	last_name: String!
	address_1: String!
	address_2: String
	city: String!
	state: String!
	zip: String!
	full_string: String


I’ve had this happen before where graphql schema updates don’t seem to change do anything despite a lack of errors. And then they stay stuck even if I try to undo my change.

Generally, it seems to be an index conflict/mismatch. For instance, renaming an index that graphql is using. Or already having an index in the database that the graphql engine wants to use to support your new graphql schema changes. Or changing a type to/from @embedded.

Anyway, the way I solved it was by directly updating the metadata in the collection that was referencing the incorrect index/collection/relation. In case you weren’t aware, the graphql part of fauna stores graphql schema information in collection metadata. There’s no easy way to track down which collection’s metadata might be incorrect. You just have to figure out what schema changes caused the issue, and what collections might be affected, and look at the metadata yourself for any inconsistencies.

To see the metadata, you need to Get the Collection like:


You can run that in the shell, and it should return some graphql meta data as part of the response. You can also use Update(Collection("Order"), {data: ...}) to make changes to the data in the collection, including the metadata.

Obviously this can screw things up if you aren’t careful, so please be careful and also save how the Collection is before you start messing with it so you can undo things later if you need to.

1 Like

The main issue is that I changed the Buyer embed into a relationship. After making that change, updating the Buyer type isn’t actually updating the buyer type. For example, removing first_name and adding a middle_name property. Once I submit the schema into the dashboard, it says its successful, but nothing changes.

Thanks for the heads up about the required directive. I don’t know how that came to my mind, but unfortunately that wasn’t the problem.

After taking a look at the metadata you were talking about, the meta data for the buyer type was actually correct using FQL, but the GraphQL playground was still not showing the correct fields and still referencing old fields that didn’t exist.

Unfortunately I don’t think updating the metadata will be the fix.

I pinpointed the cause to be the change from the buyer type being an embed to a relationship.

Are the necessary Indexes for the relationship also in place? Fauna will expect there the be the Indexes, and the indexes ALSO have gql metadata.