-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
List of known sourcemap inject
bugs
#1647
Comments
sourcemap inject
bugs
I have something to add to this list. We are using GraphQL and sometimes the injection gets injected into the template string that is defining out GraphQL queries. Here is a couple snippets to show you:
This is a minified Angular App |
Thank you for the report. The second screenshot looks gnarly. The fact that a statement starts on the same line as the pragma and then continues for several lines is going to be very hard to work around. |
Is that not normal? I don't think we are doing anything different than a normal Angular production build. I can investigate a bit to see if maybe we are doing something out of the norm? |
Sorry, I didn't mean to imply you were doing anything wrong. This is just one of several assumptions we were making that appear to not hold up in practice. |
No worries all good! I can double check that a plain angular build that is freshly generated does the same thing just so we know. |
Just generate a fresh Angular project using Nx, looks like the apps get minified to a single line. So ya. I guess that is a case you might have to handle. Let me know if I can help at all. |
@j-fulbright Does the first line of the injected JS file contain |
Actually after reviewing with another developer, it was determined the CLI is adding an extraneous semicolon in the mappings group. Reviewing of the source for the CLI, it appears this is intentional in some way, but it is breaking our sourcemaps, as removing the semicolon, makes them resolve correctly on the commandline.
Working:
After CLI:
Beginning of some of the JS files:
It is possible the pragma changes that are merged may resolve for us, since it changes regex as well |
As a workaround, I'm executing this in a React App in order to remove the semicolon in sourcemaps after injecting debugIds using sentry-cli:
I hope it works for you :) |
I am sorry for the frustration caused by this. We're currently working on putting injection on a more solid foundation. |
We just got bit by this badly, simplified reproducer: Original js file: (function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.myObject = factory());
}(this, (function () { 'use strict';
var myHTML = "\n";
return {};
}))); Minified: (()=>{var i=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var d=i((t,f)=>{(function(n,e){typeof t=="object"&&typeof f<"u"?f.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.myObject=e())})(t,function(){"use strict";var n=`
`;return{}})});d();})(); Debug ids Injected: (()=>{var i=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var d=i((t,f)=>{(function(n,e){typeof t=="object"&&typeof f<"u"?f.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.myObject=e())})(t,function(){"use strict";var n=`
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="2c4f8e42-99ad-5954-85ef-815190b8286a")}catch(e){}}();
`;return{}})});d();})();
//# debugId=2c4f8e42-99ad-5954-85ef-815190b8286a As you can see this is pretty bad, it ends up inserting the sentry debug snippet inside the |
Adding #1689 to the list to make it easier to track. |
@kamilogorek this was closed by mistake ? |
Yes, sorry. Thanks for catching this. I meant to close linked issue only 😅 |
All of these bugs should be fixed as of |
not sure if related, but we are having an issue where using "sentry-cli sourcemaps inject" has broken our projects use of the Angular SwUpdate.versionUpdates.subscribe((event: VersionEvent) As soon as we removed the
The next release went through automatic updates properly. I suspect this is causing an issue for the ServiceWorker process looking up which files need to be downloaded (hashmap lookup ?) such that the inject process breaks the hashmap of files to be downloaded by the updater ? ANY suggestions/work arounds ? I was happy to finally get proper source maps for a release working w/ Web/iOS Capacitor via the artifact bundles but now need to remove it from our CICD since broke automatic updates. |
@NSiggel To me this doesn't sound like a bug. If injecting something into your code is not feasible due to code integrity you should probably resort to the legacy method of uploading which does not need to inject but is a bit trickier to get right. If you face any more issues please open another issue since this seems unrelated. |
This trips the "use pragma" detection and causes the line to be skipped, which is obviously not intended. Solution: make the regex stricter.
we would erroneously inject at the very top. Solution: handle block comments.
'use strict';
can be on the same line as the rest of the code, eg'use strict';(function(){console.log('wat')})();
is a valid code, and we do not handle injecting snippet "in-between" - ref: Source maps inject results in corrupt source map files #1646Tasks
The text was updated successfully, but these errors were encountered: