-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: Add urlPrefix to sentry configuration #222
Conversation
Hey! thx for the contrib, really appreciate that :) |
@buenaflor I don't understand why the CI is not working here ? |
Changelog entry was missing a link to the PR, fixed it now |
I'd like to wait for #198 first before getting to this PR |
1734f61
to
9fc266e
Compare
@JoydS we merged the other pr and can continue here, there should be some changes to the code that you also need to adjust |
Can you give me more details ? |
@JoydS I think resolving the merge conflics is all you need to do here |
@buenaflor to be honnest for now I can't make it work. Do you have an idea where could be the issue ? I checked my source maps that seems good But I still don't have the trace. |
Does it not work even when not using the url prefix? |
When I do not use url prefix, my sources maps are wrong. |
d903f70
to
b601e81
Compare
Can you follow this and see if it works? getsentry/sentry-dart#897 (comment) This text was written for the plugin version |
Hello @buenaflor I just did, and it's not working. Here is my config :
Here is my error : I do have this message, is it a requirement to have my github repository set-up on sentry ? |
I've received some information that uploading debug symbols might not work with sentry-cli versions below 2.31.0 due to some issues. our newest dart plugin |
Im already in 2.0.0. Here is my logs :
Maybe the issue is from "warning: could not determine a source map reference" ? |
@denrase can you look into this? 🙏 |
Hello @denrase @buenaflor |
Hello guys, |
@JoydS Looking into this. |
I have used the plugin from your PR in the sentry flutter example app. In the override I configured the path to your fork, which I checked out locally sentry_dart_plugin:
path: ../../../forks/joyds/sentry-dart-plugin and added the prefix to the config. url_prefix: ~/app/ I build the web version with: flutter build web --source-maps and ran the plugin
Changed to the correct directory cd build/web and started a local web server python3 -m http.server Then I triggered a couple of issues and could see them on sentry.io
Also, the prefix seems to be there in the uploaded source maps
I'm not sure if there is anything, like uploads of previous releases/files, that would interfere and give us false positives here. |
Hello @denrase Im going to try to give you the more information that I can.
Dans ma config Dockerfile :
Here is my uploaded source maps : My app is here : https://preprod.yumi.club/app/ Could you give me more informations about how it suppose to work ? Im sorry but I can't create a project with the same config from scratch, I have no time for that and the config that we have is kinda complex (behind load balancer and so on). Thanks for your help |
@buenaflor @JoydS I could reproduce the issue now. Before I was still executing in the url root without prefix. I created a release with The prefix is missing in the url which is shown in the ST. The symbol maps were uploaded and showing as expected. |
2d0c5e5
to
0d8292b
Compare
@JoydS Okay sorry for the delay. The missing piece is that in the flutter sdk we have to modify the absolute path of the stackframe and add the url prefix. see my comment here basically the absolute path of each stack frame doesn't have the url prefix which messes up symbolication with the source maps if you have time please try it out and if everything is fine then we're good to go here |
Added to docs: getsentry/sentry-docs#10470 |
Hello @buenaflor & @denrase |
also let's add this to the sample when this is done @denrase |
@JoydS Here's the code that's missing. You just have to use your URL and correctly insert the prefix. options.beforeSend = (event, hint) async {
final exceptions = event.exceptions?.map((exception) {
final stackTrace = exception.stackTrace;
if (stackTrace != null) {
final frames = stackTrace.frames.map((frame) {
const baseUrl = 'https://example.com/';
final modifiedAbsPath = frame.absPath?.replaceFirst(
baseUrl,
'${baseUrl}my_prefix/',
);
return frame.copyWith(absPath: modifiedAbsPath);
}).toList();
return exception.copyWith(
stackTrace: SentryStackTrace(frames: frames),
);
}
return exception;
}).toList();
return event.copyWith(exceptions: exceptions ?? []);
}; |
Update CHANGELOG.md
Hello @denrase I added the script above, but I still have the issue : |
@JoydS You could try to debug the script and check if the prefix is set correctly. Maybe we have missed something. Sorry this is taking so long, but it's really difficult to pinpoint where the issue is. |
@denrase let's test it again and then wrap it up in a forked branch |
For running on localhost i needed to slightly update the code snippet, but again, this did work for me: options.beforeSend = (event, hint) async {
final exceptions = event.exceptions?.map((exception) {
final stackTrace = exception.stackTrace;
if (stackTrace != null) {
final frames = stackTrace.frames.map((frame) {
final modifiedAbsPath = frame.absPath?.replaceFirstMapped(
RegExp(r'(http://[^/]+)(/.*)'),
(match) => '${match.group(1)}/foo${match.group(2)}',
);
return frame.copyWith(absPath: modifiedAbsPath ?? frame.absPath);
}).toList();
return exception.copyWith(
stackTrace: SentryStackTrace(frames: frames),
);
}
return exception;
}).toList();
return event.copyWith(exceptions: exceptions ?? []);
}; Just need to make sure that the source maps also have the correct prefix. Either by setting |
Closing this in favour of this PR #253 |
📜 Description
Add UrlPrefix for Source Map
💡 Motivation and Context
Required for subpath web app
💚 How did you test it?
Closes #204
📝 Checklist
🔮 Next steps