data icon indicating copy to clipboard operation
data copied to clipboard

Build fails on `4.12.0` if project folder name contains `ember-data-`

Open dagroe opened this issue 1 year ago • 10 comments

Build fails on 4.12.0

Reproduction

  • create new ember project: ember new ember-data-bug --lang en using ember-cli: 4.12.1 node: 18.13.0
  • upgrade ember-data to 4.12.0
  • build fails with [NodeWrapper:8 /Users/myuser/ember-data-bug/tests] is not a SourceNode

I also tried to upgrade all dependencies to latest and pin them in my reproduction here: https://github.com/dagroe/ed-bug-reproduction

Description

I tried a bunch of different combinations, e.g. plain new ember install, upgrade all to latest, upgrade everything to latest but set ember-source: 4.12.0. Tried yarn and npm installs.

Everything works fine on 4.11.3 but fails with the error above on 4.12.0

Versions

└─ ember-data-bug@workspace:.
   └─ ember-source@npm:4.12.0 [a2ed2] (via npm:4.12.0 [a2ed2])
└─ ember-data-bug@workspace:.
   └─ ember-cli@npm:4.12.1 (via npm:4.12.1)
└─ ember-data-bug@workspace:.
   └─ ember-data@npm:4.12.0 [a2ed2] (via npm:4.12.0 [a2ed2])

dagroe avatar May 16 '23 11:05 dagroe

As far as I can tell builds are working with 4.12

runspired avatar May 17 '23 02:05 runspired

Closing because even the reproduction app works when I run yarn to install and ember build to build or ember serve to serve

runspired avatar May 17 '23 02:05 runspired

Very strange. Indeed, when I clone the repo it runs fine.

Drove me almost crazy, since the exact same project didn't run in my original folder where I created it. Finally I found that the error occurs when the project folder name includes the string ember-data. My original project was in folder ember-data-bug but I pushed it to github as ed-bug-reproduction. When I clone the ed-bug-reproduction repo into something like ember-data-test I get the error described above.

dagroe avatar May 17 '23 06:05 dagroe

I have also (accidentally) encountered this in ember-data v5.

Cloning a app repository name containing ember-data

(This repo is an app generated by ember-cli v5)

git clone [email protected]:gilest/ember-data-dir-name.git
cd ember-data-dir-name && pnpm install && pnpm start

Output ❌

[NodeWrapper:0 /Users/Giles/code/repros/ember-data-dir-name/node_modules/.pnpm/registry.npmjs.org+@[email protected]/node_modules/@ember/optional-features] is not a SourceNode

Cloning same repo into a different-directory

git clone [email protected]:gilest/ember-data-dir-name.git different-directory
cd different-directory && pnpm install && pnpm start

Output ✅

Build successful (4928ms) – Serving on http://localhost:4200/

gilest avatar Jun 13 '23 05:06 gilest

@gilest yeah its honestly one of the most curious bugs I've heard in a long time and ordinarily I'd jump at investigating but haven't had time. Would love a report/fix if you can dig around, its... WAT

runspired avatar Jun 13 '23 05:06 runspired

Not sure I'll get all the way to a fix but it occurs...

  • with both pnpm and yarn
  • only when the ember-data package is installed
  • when running a development or test server (with livereload). NOT when running ember test (no server)
  • with both classic and Embroider builds

NodeWrapper is something in Broccoli maybe?

Yes, error thrown from here.

🤷🏻 opened a Broccoli issue broccolijs/broccoli/issues/503

gilest avatar Jun 13 '23 05:06 gilest

Running into the same issue. My addon's name is @bagaaravel/ember-data-extensions. On my machine the folder name was ember-data-extensions. Renaming the folder "fixes" it.

bertdeblock avatar Jul 11 '23 14:07 bertdeblock

@bertdeblock think you could dig into the broccoli side a bit?

runspired avatar Jul 11 '23 23:07 runspired

The only EmberData code I could imagine might interplay to result in this has existed a long time. It's this check:

https://github.com/emberjs/data/blob/4251fd7105ea9a8eae17efb4e3bf8bb795b42ca4/packages/private-build-infra/src/addon-build-config-for-data-package.js#L118C5-L127C7

but reading that I don't see how it could affect.

runspired avatar Jul 11 '23 23:07 runspired

@runspired I've been looking into it a bit, but haven't found anything yet. Might continue looking at it today.

bertdeblock avatar Jul 12 '23 07:07 bertdeblock