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

Deprecation registerPlugin in Ember 3.28 #4015

Closed
oliverlj opened this issue Sep 28, 2021 · 6 comments · Fixed by #4714
Closed

Deprecation registerPlugin in Ember 3.28 #4015

oliverlj opened this issue Sep 28, 2021 · 6 comments · Fixed by #4714
Assignees

Comments

@oliverlj
Copy link

oliverlj commented Sep 28, 2021

on ember serve command after installing the addon

DEPRECATION: registerPlugin is deprecated, please pass plugins directly via `compile` and/or `precompile`. [deprecation id: template-compiler.registerPlugin]
        at logDeprecationStackTrace (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:1984:21)
        at HANDLERS.<computed> (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2117:9)
        at raiseOnDeprecation (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2011:9)
        at HANDLERS.<computed> (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2117:9)
        at invoke (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2129:9)
        at deprecate (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2085:28)
        at Object.registerPlugin (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:20892:47)
        at registerPlugins (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/utils.js:136:26)
        at Object.setup (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/utils.js:194:3)
        at Class.included (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/ember-addon-main.js:174:36)
        at Class.superWrapper [as included] (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/core-object/lib/assign-properties.js:34:20)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:497:26
        at Array.reduce (<anonymous>:null:null)
        at Class.eachAddonInvoke (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:494:24)
        at Class.included (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:769:10)
        at Class.superWrapper [as included] (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/core-object/lib/assign-properties.js:34:20)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:653:15
        at Array.forEach (<anonymous>:null:null)
        at EmberApp._notifyAddonIncluded (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:651:25)
        at new EmberApp (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:137:10)
        at module.exports (/home/oliver/git/fritzy/front/fz-front-simulator/ember-cli-build.js:59:15)
        at Builder.readBuildFile (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:49:14)
        at Builder.setupBroccoliBuilder (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:63:22)
        at new Builder (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:29:10)
        at ServeTask.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/tasks/serve.js:49:7)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/command.js:238:24
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at Class.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/commands/serve.js:106:5)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/cli.js:204:32
        at CLI.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/cli.js:251:14)
        at module.exports (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/index.js:145:12)
DEPRECATION: registerPlugin is deprecated, please pass plugins directly via `compile` and/or `precompile`. [deprecation id: template-compiler.registerPlugin]
        at logDeprecationStackTrace (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:1984:21)
        at HANDLERS.<computed> (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2117:9)
        at raiseOnDeprecation (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2011:9)
        at HANDLERS.<computed> (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2117:9)
        at invoke (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2129:9)
        at deprecate (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:2085:28)
        at Object.registerPlugin (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-source/dist/ember-template-compiler.js:20892:47)
        at registerPlugins (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/utils.js:136:26)
        at Object.setup (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/utils.js:194:3)
        at Class.included (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/@sentry/ember/node_modules/ember-cli-htmlbars/lib/ember-addon-main.js:174:36)
        at Class.superWrapper [as included] (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/core-object/lib/assign-properties.js:34:20)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:497:26
        at Array.reduce (<anonymous>:null:null)
        at Class.eachAddonInvoke (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:494:24)
        at Class.included (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/addon.js:769:10)
        at Class.superWrapper [as included] (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/core-object/lib/assign-properties.js:34:20)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:653:15
        at Array.forEach (<anonymous>:null:null)
        at EmberApp._notifyAddonIncluded (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:651:25)
        at new EmberApp (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/broccoli/ember-app.js:137:10)
        at module.exports (/home/oliver/git/fritzy/front/fz-front-simulator/ember-cli-build.js:59:15)
        at Builder.readBuildFile (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:49:14)
        at Builder.setupBroccoliBuilder (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:63:22)
        at new Builder (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/builder.js:29:10)
        at ServeTask.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/tasks/serve.js:49:7)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/models/command.js:238:24
        at processTicksAndRejections (internal/process/task_queues.js:95:5)
        at Class.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/commands/serve.js:106:5)
        at /home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/cli.js:204:32
        at CLI.run (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/cli.js:251:14)
        at module.exports (/home/oliver/git/fritzy/front/fz-front-simulator/node_modules/ember-cli/lib/cli/index.js:145:12)
@oliverlj
Copy link
Author

oliverlj commented Oct 2, 2021

Depreciation warning appears from 6.13.0, maybe because of this : #3962

I Have more.

The sentry object is mandatory in the config. I didn't specified it.

// ember-cli-build.js
ENV['@sentry/ember'] = {
  disableInstrumentComponents: true,
  disablePerformance: true,
  disableRunloopPerformance: true,
 // Mandatory
  sentry: {},
};

You need to explain that in doc.
https://docs.sentry.io/platforms/javascript/guides/ember/configuration/ember-options/#performance-monitoring-considerations

When building a production build without the sentry object, app doesn't start :

chunk.607.c9a91a5719ecf581766f.js:2 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at a (sentry-performance.js:23)
    at Object.s [as initialize] (sentry-performance.js:28)
    at index.js:136
    at e.each (dag-map.js:231)
    at e.walk (dag-map.js:145)
    at e.each (dag-map.js:75)
    at e.topsort (dag-map.js:83)
    at a._runInitializer (index.js:151)
    at a.runInstanceInitializers (index.js:134)
    at e._bootSync (instance.js:111)
    at a.didBecomeReady (application.js:700)
    at invoke (backburner.js:338)
    at p.flush (backburner.js:229)
    at h.flush (backburner.js:426)
    at B._end (backburner.js:958)
    at B.end (backburner.js:708)
    at B._run (backburner.js:1013)
    at B.run (backburner.js:752)
    at d (index.js:116)
    at HTMLDocument.e (application.js:434)
    at HTMLDocument.n (chunk.607.c9a91a5719ecf581766f.js:2)

Here is my app docker build for production if you want to test the case (https required in local because of service worker) : registry.gitlab.com/fritzy/front/fz-front-simulator/production:0.26.2

k-fish added a commit that referenced this issue Oct 4, 2021
As noted in #4015, a registerPlugin deprecation is now caused by @sentry/ember because of the Ember version upgrade. As mentioned here, emberjs/ember.js#19429 updating htmlbars should fix this.
@k-fish
Copy link
Member

k-fish commented Oct 4, 2021

@oliverlj thanks for letting us know 👍 , I've checked the deprecation and am putting a PR to fix it.

For your second question about the sentry object, as mentioned in https://docs.sentry.io/platforms/javascript/guides/ember/#configure, are you calling Sentry.init in your app.js before you create the application? The sentry object shouldn't be mandatory as it's filled in with the object passed to Sentry.init when it is called. Sentry.init is mandatory.

@oliverlj
Copy link
Author

oliverlj commented Oct 4, 2021

@k-fish thanks for the fix. I will try.

I have setup Sentry.init in my app : https://gitlab.com/fritzy/front/fz-front-simulator/-/blob/develop/app/app.ts

Now, I have move all property to environnement : https://gitlab.com/fritzy/front/fz-front-simulator/-/blob/develop/config/addons.js

If I move sentry object to app, error will pop

AbhiPrasad pushed a commit that referenced this issue Oct 4, 2021
As noted in #4015, a registerPlugin deprecation is now caused by @sentry/ember because of the Ember version upgrade. As mentioned here, emberjs/ember.js#19429 updating htmlbars should fix this.
@eredi93
Copy link

eredi93 commented Mar 10, 2022

@k-fish I'm hitting the same issue as well!

I followed https://docs.sentry.io/platforms/javascript/guides/ember/#configure and i installed the package with:

ember install @sentry/ember

And then I added the init to the app/app.js, this is my app file:

import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';

import * as Sentry from "@sentry/ember";

Sentry.init({
  dsn: "https://XXXXXXXXX@o386910.ingest.sentry.io/6236535",

  // Set tracesSampleRate to 1.0 to capture 100%
  // of transactions for performance monitoring.
  // We recommend adjusting this value in production
  tracesSampleRate: 1.0,
});

export default class App extends Application {
  modulePrefix = config.modulePrefix;
  podModulePrefix = config.podModulePrefix;
  Resolver = Resolver;
}

loadInitializers(App, config.modulePrefix);

when I build my production app ember build --environment=production
The app fails to boot with:

Uncaught TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at s (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:5261:15)
    at Object.o [as initialize] (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:5261:73)
    at vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:1667:679
    at e.each (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:3145:1)
    at e.walk (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:3135:30)
    at e.each (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:3127:157)
    at e.topsort (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:3127:203)
    at l._runInitializer (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:1670:3)
    at l.runInstanceInitializers (vendor-97794bdecc80a6dac0d5859bd7e4d8ac.js:1667:629)

@k-fish
Copy link
Member

k-fish commented Mar 14, 2022

@eredi93 as mentioned above, try adding sentry: {}, to your env config and see if it no longer crashes. I've put a fix up, once it's in, I believe you should no longer need the env config modification.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 3, 2022

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

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

Successfully merging a pull request may close this issue.

6 participants