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

Error with ember-private-api.js and __loader #1378

Closed
ynotdraw opened this issue Mar 23, 2023 · 6 comments
Closed

Error with ember-private-api.js and __loader #1378

ynotdraw opened this issue Mar 23, 2023 · 6 comments

Comments

@ynotdraw
Copy link

ynotdraw commented Mar 23, 2023

For some reason this morning across multiple repos I'm getting the following error in our v2 add-ons using embroider optimized in our ember-try configs:

not ok 1 Chrome 111.0 - [undefined ms] - Global error: Uncaught TypeError: Cannot read properties of undefined (reading '__loader') at webpack://test-app/../node_modules/.pnpm/@embroider+util@1.10.0_o3ueax46tohlct7p74rdwqxbue/node_modules/@embroider/util/ember-private-api.js?, line 16
94
    ---
95
        browser log: |
96
            {"type":"error","text":"Uncaught TypeError: Cannot read properties of undefined (reading '__loader') at webpack://test-app/../node_modules/.pnpm/@embroider+util@1.10.0_o3ueax46tohlct7p74rdwqxbue/node_modules/@embroider/util/ember-private-api.js?, line 16\n","testContext":{}}

Which points to

runtime = window.Ember.__loader.require('@glimmer/runtime');

The ember-try config we are using:

I'm still digging through the code, but I'm curious why it is going this route, when this macro condition should be met as we are using a new-ish version of Ember?

dependencySatisfies('ember-source', '>=3.27.0-canary || >=3.27.0-beta')

Other potentially helpful links:

@NullVoxPopuli
Copy link
Collaborator

did your lockfile change?
dependencySatisfies only fails when the dependencies are messed up.

Try the following:

  • delete all node_modules and lockfile, re-install
  • pnpm dedupe
  • make sure ember-headless-form and ember-toucan-core are injected in to the test app (because they are in-repo packages)

@embroider/util correctly declares a peer on ember-source:

"ember-source": "*",

So the ember-source that should be used should (maybe isn't!) be the one that is used from the app.

One last thing to try may be to see if the upcoming release of @embroider/* packages will solve your issue.

On this project, I update a branch using unstable embroider nightly so I can see what's going on, if I need to -- here is the workflow/script that helps update all those dependencies https://github.com/NullVoxPopuli/limber/blob/main/.github/workflows/preview-embroider-upgrade.yml
(though, what I'm doing is very aggressive and changing my whole dependency tree).
You may be able to just get away with something like this:

pnpm -r update @embroider/test-setup@unstable @embroider/addon-shim@unstable @embroider/addon-dev@unstable @embroider/webpack@unstable

@ynotdraw
Copy link
Author

ynotdraw commented Mar 23, 2023

did your lockfile change?

The super interesting thing to me is I just created a PR based off of main in ember-headless-form to get a build and it's now failing with no "real" code changes (only a format to ci.yml); however, main was fine 2 days ago.

Will give the other options a go! @nicolechung is giving above a try

One other interesting thing: I can't reproduce any of this locally, only in CI 🙃

@NullVoxPopuli
Copy link
Collaborator

Of note, you're using a floating version of pnpm in C.I.: https://github.com/CrowdStrike/ember-headless-form/blob/main/.github/actions/pnpm/action.yml#L8

so it's possible that a recent update in pnpm is causing this -- you could verify by updating your local version to the latest (7.30.1 at the time of writing)

@NullVoxPopuli
Copy link
Collaborator

NullVoxPopuli commented Mar 23, 2023

Also, this was a temporary fix for a temporary pnpm problem: https://github.com/CrowdStrike/ember-headless-form/blob/main/.github/actions/pnpm/action.yml#L16

you may want to back that out or remove the custom pnpm action entirely in favor of: https://github.com/NullVoxPopuli/limber/blob/main/.github/workflows/ci.yml#L40

On my own addon: NullVoxPopuli/ember-resources#841, I have issues, but not the one you've reported -- which at least tells me this is more a dependency issue than an embroider one.

Correctly reporting errors for these situations is quite hard, and I'm not sure what's best.
Kinda curious what adding npx are-my-node-modules-messed-up to C.I. would report

@ynotdraw
Copy link
Author

Wow. Thanks a bunch for the info @NullVoxPopuli. It is in fact an issue with pnpm. I set the version to 7.30.0 instead of what was just released ( 7.30.1 ) and things are working again (CrowdStrike/ember-toucan-core#98). Apologies for the noise here. I'll go see if I can track this down there! 🙇

@NullVoxPopuli
Copy link
Collaborator

it may be worth reporting an issue on the pnpm repo

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

2 participants