Ember Data Serializer TypeError while saving record [SOLVED]

I am using JSONAPISerializer/JSONAPIAdapter for my backend(JSONAPI spec conform). All GET requests are working fine. I have issues with saving records. While saving a record the serializer creates this error: TypeError: Invalid Fullname, expected: type:name got: model:(…)

Strangely, the POST request is send properly and saved at the backend but Ember stucks. Here are some details for serializer and adapter:

export default DS.JSONAPIAdapter.extend({
	host: 'http://localhost:1313',
	namespace: 'api/page',
	pathForType: function(modelName) {
    	return "regionen";
  },
  createRecord: function(store, type, snapshot) {
      console.log("-->", type.modelName);
      let url = `${this.host}/${this.namespace}/${snapshot.attr('path')}`;
      let data = {};
      let serializer = store.serializerFor(type.modelName);
      serializer.serializeIntoHash(data, type, snapshot);
      return $.ajax({
        type: 'POST',
        url: url,
        data: JSON.stringify(data)
      });
  }, ...

export default DS.JSONAPISerializer.extend({
  	normalize(modelClass, resourceHash, prop) {
  		resourceHash.attributes.bandnummer = `${resourceHash.attributes.metadata.bandnummer}`
  		resourceHash.attributes.title = `${resourceHash.attributes.metadata.title}`
  		return this._super(...arguments)
  	},
  	serializeIntoHash(hash, typeClass, snapshot) {
		hash["page"] = this.serialize(snapshot);
	},
	serialize(snapshot) {
		let serializedData = {
			"attributes": {
				"path": snapshot.attr("path"),
				"metadata": {
					"title": snapshot.attr("title"),
					"bandnummer": snapshot.attr("bandnummer")   					
				},
				"content": snapshot.attr("content")
			}			
		};

		if (snapshot.id) {
			serializedData.id = snapshot.id;
		};    		   			
		return serializedData;
	}
});

Any helpful suggestions to solve this?

So the JSON API request and response are correct when you inspect it in the Network panel? I would set a breakpoint in normalize. You need to share more details about the error.

By inspecting the POST request response, I’ve noticed that my api backend “CreateObject” handler left the resource type untouched. So the POST response got an empty type:"". Solving this, leads to proper behaviour of ember.

Thanks for debugging tip