You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a problem that happens when running in not DEBUG mode, when the project build it's done for production (not staging). The issue happens when the REST Serializer tries to get the modelName from the root object returned from an API. The serializer doesn't find a model and tries to throw a warning:
When trying to execute this.warnMessageNoModelForKey, this method doesn't exist because it's only added with DEBUG mode (!PRODUCTION, according to the code):
'" in payload, but no model was found for model name "'+
typeKey+
'" (resolved model name using '+
this.constructor.toString()+
'.modelNameFromPayloadKey("'+
prop+
'"))'
);
},
});
}
The error could be happening in the last versions of Ember Data, according what I can see in the code. I understand this issue has low priority as Serializers/Adapters are deprecated in the last versions of the library.
Versions
ember-data v5.3.9
ember-source v5.8.0
The text was updated successfully, but these errors were encountered:
based on the git blame (and my own memory) that has been a debug only warning for ~7 years
(which would put it in the 1.x timeframe)
While there has been some recent (past year) changes to how we make the check to determine if the warning should be printed, the check has never guarded for production. For instance
What this means is that somehow you're the first to report a bug that should likely have been reported 7 years ago 🤦♂️
I'm willing to implement a fix for this as it would be relatively simple; however, the warning here is also telling you that in production you are receiving resources in payloads that you don't have models for. This is something I want to make a bit safer (since its nice to not unnecessarily blow up in prod) but this is far from the only location in the code which would result in an unknown resource generating an exception today. So you may find that the fix just punts the exception to a new location 🙈
Description & Reproduction
This is a problem that happens when running in not DEBUG mode, when the project build it's done for production (not staging). The issue happens when the REST Serializer tries to get the modelName from the root object returned from an API. The serializer doesn't find a model and tries to throw a warning:
data/packages/serializer/src/rest.js
Lines 279 to 285 in 8553b77
When trying to execute
this.warnMessageNoModelForKey
, this method doesn't exist because it's only added with DEBUG mode (!PRODUCTION, according to the code):data/packages/serializer/src/rest.js
Lines 797 to 813 in 8553b77
The error could be happening in the last versions of Ember Data, according what I can see in the code. I understand this issue has low priority as Serializers/Adapters are deprecated in the last versions of the library.
Versions
ember-data v5.3.9
ember-source v5.8.0
The text was updated successfully, but these errors were encountered: