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

4.12.x - this.requestManager is undefined #8565

Closed
mkszepp opened this issue Apr 13, 2023 · 8 comments
Closed

4.12.x - this.requestManager is undefined #8565

mkszepp opened this issue Apr 13, 2023 · 8 comments

Comments

@mkszepp
Copy link
Contributor

mkszepp commented Apr 13, 2023

The latest version (atm 4.12.0), is not anymore working with embroider :( embroider-build/embroider#1322 (comment)

grafik

Error while processing route: index this.requestManager is undefined request@webpack://app-name/./node_modules/@ember-data/store/index-8b77b852.js?:5453:20
query@webpack://app-name/./node_modules/@ember-data/store/index-8b77b852.js?:6398:26
query@webpack://app-name/./services/store.js?:69:33
authenticate@webpack://app-name/./services/session-user.js?:43:23
beforeModel@webpack://app-name/./routes/rg.js?:39:28
runBeforeModelHook@http://localhost:5600/nt/assets/vendor.js:45450:31
resolve/<@http://localhost:5600/nt/assets/vendor.js:45374:26
invokeCallback@http://localhost:5600/nt/assets/vendor.js:47160:17
publish@http://localhost:5600/nt/assets/vendor.js:47146:23
@http://localhost:5600/nt/assets/vendor.js:42721:62
invoke@http://localhost:5600/nt/assets/vendor.js:41306:16
flush@http://localhost:5600/nt/assets/vendor.js:41221:19
flush@http://localhost:5600/nt/assets/vendor.js:41384:21
_end@http://localhost:5600/nt/assets/vendor.js:41825:34
Backburner/this._boundAutorunEnd@http://localhost:5600/nt/assets/vendor.js:41549:14

The error occures, when we remove all packageRules, which is brings embroider (the next version has removed this), otherwise we run in an error while build



packageRules: [
      {
        package: '@ember-data/store',
        addonModules: {
          '-private.js': {
            dependsOnModules: [],
          },
          '-private/system/core-store.js': {
            dependsOnModules: [],
          },
          '-private/system/model/internal-model.js': {
            dependsOnModules: [],
          },
        },
      },
    ],
@Jopie01
Copy link

Jopie01 commented Apr 13, 2023

Do you extend the Store? If so, maybe #8491 (comment) will help as the error says this.requestManager is undefined.

@mkszepp
Copy link
Contributor Author

mkszepp commented Apr 13, 2023

@Jopie01 yes i have extend the Store. I can confirm, that it works with this "workaround", because adding an constructor for an service extend is a little bit strange, because i have not overwritten the constructor since now...

I have found your comment example now also in the repo documentation (https://github.com/emberjs/data/tree/v4.12.0/packages/request#using-with-ember-data) but the example in the emberjs documentation is not up to date (https://api.emberjs.com/ember-data/release/classes/Store).

I was upgrading from 4.11.3 to 4.12.0 and i have found no information about this more/less braking change in the ReadMe (https://github.com/emberjs/data/blob/v4.12.0/CHANGELOG.md). There was no warning in the browser console and i think that also other peoples are running in the same issue...
Maybe there is at least necessary, to link to the documentation when somebody is running in this error...

@Jopie01
Copy link

Jopie01 commented Apr 13, 2023

Yeah, when I ran into it, it was alpha. But have you also read the answers of @runspired? #8491 (comment) and #8491 (comment). To me it seems there is now a difference between @ember-data and ember-data. But how that should work exactly you should ask @runspired because during that time things were changing and as I was working on something completely new, I used the new pattern.

@mkszepp
Copy link
Contributor Author

mkszepp commented Apr 13, 2023

@Jopie01 yes i have read your issue and all comments...
I have replaced import Store from '@ember-data/store'; with import Store from 'ember-data/store'; and it works like before.

I think, that this change should be added in the changelog / documentation and the exception should be handled better in the app, so everybody knows, which changes are necessary after the upgrade. Maybe there is also possible to add this in ember-cli?

@runspired
Copy link
Contributor

runspired commented Apr 14, 2023

The need to do this configuration is extensively documented.

If you're extending @ember-data/store but using ember-data you will always have trouble because your application is already taking the unhappy path.

If using ember-data extend ember-data/store (we need to fix the lint rule here), if not using ember-data then the configuration shown in the docs needs to be done as appropriate for the feature set you want.

Note the store documentation you link above is correct. You probably went there out of context though, may have helped to have read the docs for that package first: https://api.emberjs.com/ember-data/release/modules/@ember-data%2Fstore

@mkszepp
Copy link
Contributor Author

mkszepp commented Apr 14, 2023

@runspired if i have understand correctly ember-data package is legacy and in the future we should replace it with the single packages (@ember-data/*) right?

This is already now possible or?

@runspired
Copy link
Contributor

@mkszepp I'd describe it as in-flux, but mostly legacy. It's been possible to replace it with the individual packages since ~3.12

ember-data represents the "recommended experience for JSON:API" if you will, but being as what is recommended is in-flux as we iterate towards the Polaris experience this means that package has lagged what is best. It will evolve to match the current "recommended defaults for JSON:API" Over the course of 5.x as we deprecate model/adapter/serializer. It's also important to note the language here is not "recommended experience" but "recommended experience for JSON:API". For 6.x+ we're hoping to have evolved the ember new command to be able to also run the proposed npx ember-data flow which allows selection of desired experience and features to occur and be configured.

@mkszepp mkszepp changed the title 4.12.0 is not anymore working with embroider 4.12.0 - this.requestManager is undefined Apr 14, 2023
@mkszepp mkszepp changed the title 4.12.0 - this.requestManager is undefined 4.12.x - this.requestManager is undefined Apr 14, 2023
@mkszepp
Copy link
Contributor Author

mkszepp commented Apr 14, 2023

@runspired thanks, now everything is clear to me.

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

3 participants