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

breaks when using ember-data 4.8.0 #2461

Closed
st-h opened this issue Nov 5, 2022 · 15 comments
Closed

breaks when using ember-data 4.8.0 #2461

st-h opened this issue Nov 5, 2022 · 15 comments

Comments

@st-h
Copy link

st-h commented Nov 5, 2022

I upgraded ember-data from 4.7 to 4.8.0. When building the app, I see the following build error, which traces back to ember-cli-mirage. Downgrading ember-data to 4.7.0 fixes the issue.

Dang! Looks like a Build Error.

@embroider/macros/runtime.js

myapp/@embroider/macros/runtime.js: @babel/template placeholder "SAMPLE_FEATURE_FLAG": Expected string substitutionError: @babel/template placeholder "SAMPLE_FEATURE_FLAG": Expected string substitution
    at applyReplacement (myapp/node_modules/@babel/template/lib/populate.js:74:13)
    at myapp/node_modules/@babel/template/lib/populate.js:44:7
    at Array.forEach (<anonymous>)
    at populatePlaceholders (myapp/node_modules/@babel/template/lib/populate.js:42:43)
    at myapp/node_modules/@babel/template/lib/string.js:20:51
    at myapp/node_modules/@babel/template/lib/builder.js:75:14
    at Object.buildLiterals (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/evaluate-json.js:377:73)
    at Object.inlineRuntimeConfig (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/get-config.js:107:55)
    at PluginPass.enter (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/macros-babel-plugin.js:77:38)
    at newFn (myapp/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (myapp/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (myapp/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (myapp/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (myapp/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (myapp/node_modules/@babel/traverse/lib/index.js:50:34)
    at transformFile (myapp/node_modules/@babel/core/lib/transformation/index.js:83:29)
    at transformFile.next (<anonymous>)
    at run (myapp/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (myapp/node_modules/@babel/core/lib/transform.js:22:41)
    at transform.next (<anonymous>)
    at evaluateSync (myapp/node_modules/gensync/index.js:251:28)
    at sync (myapp/node_modules/gensync/index.js:89:14)
    at stopHiding - secret - don't use this - v1 (myapp/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at Object.transform (myapp/node_modules/@babel/core/lib/transform.js:36:80)
    at myapp/node_modules/broccoli-babel-transpiler/lib/worker.js:12:31
    at tryCatcher (myapp/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (myapp/node_modules/rsvp/dist/rsvp.js:498:33)
    at myapp/node_modules/rsvp/dist/rsvp.js:562:16
    at flush (myapp/node_modules/rsvp/dist/rsvp.js:2441:7)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
    =============
    at Object.buildLiterals (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/evaluate-json.js:377:34)
    at Object.inlineRuntimeConfig (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/get-config.js:107:55)
    at PluginPass.enter (myapp/node_modules/ember-cli-mirage/node_modules/@embroider/macros/src/babel/macros-babel-plugin.js:77:38)
    at newFn (myapp/node_modules/@babel/traverse/lib/visitors.js:159:21)
    at NodePath._call (myapp/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (myapp/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:84:31)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitMultiple (myapp/node_modules/@babel/traverse/lib/context.js:67:17)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:119:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at NodePath.visit (myapp/node_modules/@babel/traverse/lib/path/context.js:90:52)
    at TraversalContext.visitQueue (myapp/node_modules/@babel/traverse/lib/context.js:96:16)
    at TraversalContext.visitSingle (myapp/node_modules/@babel/traverse/lib/context.js:72:19)
    at TraversalContext.visit (myapp/node_modules/@babel/traverse/lib/context.js:121:19)
    at traverseNode (myapp/node_modules/@babel/traverse/lib/traverse-node.js:18:17)
    at traverse (myapp/node_modules/@babel/traverse/lib/index.js:50:34)
    at transformFile (myapp/node_modules/@babel/core/lib/transformation/index.js:83:29)
    at transformFile.next (<anonymous>)
    at run (myapp/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at transform (myapp/node_modules/@babel/core/lib/transform.js:22:41)
    at transform.next (<anonymous>)
    at evaluateSync (myapp/node_modules/gensync/index.js:251:28)
    at sync (myapp/node_modules/gensync/index.js:89:14)
    at stopHiding - secret - don't use this - v1 (myapp/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at Object.transform (myapp/node_modules/@babel/core/lib/transform.js:36:80)
    at myapp/node_modules/broccoli-babel-transpiler/lib/worker.js:12:31
    at tryCatcher (myapp/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (myapp/node_modules/rsvp/dist/rsvp.js:498:33)
    at myapp/node_modules/rsvp/dist/rsvp.js:562:16
    at flush (myapp/node_modules/rsvp/dist/rsvp.js:2441:7)
    at processTicksAndRejections (internal/process/task_queues.js:77:11)
@cah-brian-gantzler
Copy link
Collaborator

SAMPLE_FEATURE_FLAG is not actually defined in this repo. Not sure if it is ember possibly embroider/macros.

This could be an issue with many addons being on different versions of embroider/macros. In my own application I have the following trying to fix this. Curious if you try something like this and update to a later (or latest) version if that might help. I used this to fix ember-cli-babel as well. Since ember-cli-mirage specifies a version of mirage, this also lets me use the higher version of mirage without waiting for ember-cli-mirage to update.

"resolutions": {
    "miragejs": "~0.1.46",
    "@embroider/macros": "^1.9.0",
    "@embroider/util": "^1.9.0",
    "ember-cli-babel": "^7.26.1",
    "@fortawesome/fontawesome-svg-core": "1.2.35"
  }

@st-h
Copy link
Author

st-h commented Nov 30, 2022

I also ended up pinning @embroider/macros to 1.9.0 and the error went away.

@cah-brian-gantzler
Copy link
Collaborator

Great, This is really an issue all addons have (since so many depend on embroider/macros) and keeping up to date yet supporting older versions

@robbytx
Copy link

robbytx commented Feb 16, 2023

Per embroider-build/embroider#1077 (comment):

In the case of @embroider/macros it is safe to replace all of 0.x with ^1.0.0.

@grapho
Copy link

grapho commented Apr 21, 2023

Is there a current fix for this or workaround for this?

i've tried pinning the resolutions like the above suggestions.. but it has not worked .. i'm stuck at ember 4.8 and data 4.7 😢

@cah-brian-gantzler
Copy link
Collaborator

I currently am on ember data 4.11.3 with the following pins. Had to add ember modifier to them until all the addons Im using get updated to 4.0

"resolutions": {
    "miragejs": "~0.1.47",
    "@embroider/macros": "^1.10.0",
    "@embroider/util": "^1.10.0",
    "ember-cli-babel": "^7.26.1",
    "ember-modifier": "^3.2.7",
    "@fortawesome/fontawesome-svg-core": "1.2.35"
  }

@grapho
Copy link

grapho commented Apr 21, 2023

eh.. seems like any resolution i try to pin i get the exact same error.. time to dig through some logs.. thanks though

@drewpereli
Copy link

@grapho Not sure if this is helpful, but it wasn't working for me either. Turns out "resolutions" is yarn specific, and if you're using npm you have to use "overrides" instead.

@cah-brian-gantzler
Copy link
Collaborator

Thats a shame that npm does not use the same section name. Any idea if pnpm has the capability and what word they use?

@drewpereli
Copy link

Looks like pnpm has pnpm.overrides

@ndekeister-us
Copy link

Had same error, using [email protected] fixed it

@acorncom
Copy link
Collaborator

@st-h anything else actionable here or should we close this?

@st-h
Copy link
Author

st-h commented Sep 12, 2023

Please feel free to close. Sorry, but I no longer use mirage.

@cah-brian-gantzler
Copy link
Collaborator

For clarification, do you no longer use mirage? or use mirage just not this addon? If you no longer use mirage, what have you replaced it with?

As an FYI I still use mirage, but no longer use this addon.

@ewal
Copy link

ewal commented Jan 25, 2024

If anyone still looking for a solution - try locking @embroider/macros and @embroider/utils to v1.10.0 together with setting the flag SAMPLE_FEATURE_FLAG to false as described on the following page Package @ember-data/canary-features.

Tested with ember-data v4.8.4 and v4.12.5 and together with ember-cli-mirage v2.4.0.

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

8 participants