Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion Failed with Embroider #690

Open
zion03 opened this issue Dec 25, 2020 · 3 comments
Open

Assertion Failed with Embroider #690

zion03 opened this issue Dec 25, 2020 · 3 comments

Comments

@zion03
Copy link

zion03 commented Dec 25, 2020

Environment

Ember: 3.23.1
Ember Data : 3.23.0
Embroider: 0.35.0

Steps to Reproduce

Build app with Embroider and problem here owner.factoryFor when validating
Uncaught Error: Assertion Failed: Validator not found of type: presence.

@patocallaghan
Copy link

I'm also seeing this. In my testing it works fine in Embroider's "Safe" mode which is the mode that offers most backwards compatibility with existing Ember apps. The error seems to occur when Embroider's "Optimized" mode is enabled, i.e. tree-shaking turned on.

I have a sample app repo which exhibits the problem. Just load the app and open the homepage, it throws the following error in the console

vendor.js:20816 Error while processing route: index Assertion Failed: Validator not found of type: presence. Error: Assertion Failed: Validator not found of type: presence.
    at Object.assert (http://localhost:7020/assets/vendor.js:33429:15)
    at validate (webpack:///./node_modules/ember-validators/index.js?:7:52)
    at Class.validate (webpack:///./node_modules/ember-cp-validations/-private/ember-validator.js?:8:83)
    at eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:377:24)
    at eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:463:15)
    at Array.map (<anonymous>)
    at generateValidationResultsFor (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:441:21)
    at Class.eval (webpack:///./node_modules/ember-cp-validations/validations/factory.js?:376:29)
    at Class.eval (webpack:///./node_modules/ember-cp-validations/utils/cycle-breaker.js?:21:17)
    at http://localhost:7020/assets/vendor.js:12259:25

You can see the validations I added by viewing this commit. They are essentially the ones from the basic ember-cp-validations example in the docs.

@mival
Copy link

mival commented Aug 5, 2021

@snewcomer Hello, I saw you fix ember-validators (version 4.0.0). Can you please bump dependency here (ember-cp-validations) to support embroider?

@EnotPoloskun
Copy link

@offirgolan @snewcomer Can you please update ember-validators dependency for making it embroider treeshaking compatible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants