Closed williamsantoso93 closed 3 months ago
Hi @williamsantoso93, unfortunately, I will require more information about your setup in order to be able to understand what is going wrong and help you fix the problem. At a minimum, I will need the logs from sentry-cli
. You should be able to find these within the Xcode build logs.
It would also be extremely helpful if you can share any of the following:
Hi @szokeasaurusrex, this is Xcode build logs :
It said that sentry-cli not installed, but I have installed using brew install getsentry/tools/sentry-cli
My Project is not open source, but I have created brand new project, add sentry using step to reproduce above and it still happen.
@williamsantoso93 would you be able to share the build Run Script you are using to run the Sentry CLI?
Hi @szokeasaurusrex, this is the build Run Script
# This script is responsable to upload debug symbols and source context for Sentry.
if which sentry-cli >/dev/null; then
export SENTRY_ORG=test-6aq
export SENTRY_PROJECT=apple-ios
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
fi
I also add these following lines to the Input Files section
${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}
$(SRCROOT)/.sentryclirc
@williamsantoso93 I think your problem might be that you need to install the Sentry CLI within the build script (at the beginning, before calling the CLI). Xcode build scripts run in a sandbox, so it is possible that the build script cannot access your local installation on Sentry CLI
Please let me know if that change fixes your problem; if it does, I will update the relevant docs page here: https://docs.sentry.io/platforms/apple/guides/ios/sourcecontext/#3-xcode-build-phase
@szokeasaurusrex I have added curl -sL https://sentry.io/get-cli/ | sh
in the build script
curl -sL https://sentry.io/get-cli/ | sh
# This script is responsable to upload debug symbols and source context for Sentry.
if which sentry-cli >/dev/null; then
export SENTRY_ORG=test-6aq
export SENTRY_PROJECT=apple-ios
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
fi
It shows this notif
But it still doesn't upload the debug symbol files
Hey, @szokeasaurusrex is currently out of office, he'll take a look next week.
@williamsantoso93 I am unsure what the problem is based on the logs you have provided; everything appears to be normal.
Could you try running the build again, this time setting the log level to debug
, and share the resulting logs? You can set the log level to debug
by passing --log-level=debug
to the CLI or by setting the SENTRY_LOG_LEVEL
environment variable to debug
.
@szokeasaurusrex , I have added log level to debug in my script
if which sentry-cli >/dev/null; then
export SENTRY_ORG=test-6aq
export SENTRY_PROJECT=apple-ios
export SENTRY_LOG_LEVEL=debug
ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, install using 'brew install getsentry/tools/sentry-cli'"
fi
@williamsantoso93 I don't see any debug logs from Sentry CLI in the log file you linked, can you please check you copied the correct logs?
@szokeasaurusrex yes, that's the export of all message in my xcode build logs.
yes, that's the export of all message in my xcode build logs
@williamsantoso93 in that case, you are not calling Sentry CLI with debug logging. When run with the log level set to debug, the first thing the Sentry CLI prints is a line like the following, with the date/time, version number, platform, and architecture replaced with the appropriate values:
DEBUG 2024-02-26 14:37:32.697952 +01:00 sentry-cli version: 2.28.6, platform: "darwin", architecture: "arm64"
In particular, this line always includes the string sentry-cli
. However, I searched the log file you provided for the string sentry-cli
, and there were no results.
If you are certain that you have provided the correct build logs, then the sentry-cli
string's absence from the output logs would indicate that either the Sentry CLI log level was not correctly set to debug
, or the Sentry CLI did not get called at all during this build.
You will have to correct your configuration so that the Sentry CLI debug logs are included in the build logs. Once you have build logs with the debug output from the CLI, please share them with me, and I will be able to continue assisting :)
Hi @szokeasaurusrex, I have the logs because, I changed the script into
if which sentry-cli >/dev/null; then
export SENTRY_ORG=test-6aq
export SENTRY_PROJECT=apple-ios
sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" --log-level=debug 2>&1 >/dev/null
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, install using 'brew install getsentry/tools/sentry-cli'"
fi
I only get this Logs
INFO 2024-02-29 13:40:38.546011 +07:00 Loaded config from /Users/williamsantoso/Documents/Parkee/Project/Test sentry/.sentryclirc
DEBUG 2024-02-29 13:40:38.546226 +07:00 sentry-cli version: 2.28.6, platform: "darwin", architecture: "arm64"
INFO 2024-02-29 13:40:38.546835 +07:00 sentry-cli was invoked with the following command line: "sentry-cli" "debug-files" "upload" "--include-sources" "/Users/williamsantoso/Library/Developer/Xcode/DerivedData/Test_sentry-fczcdguhuxnypkegkhelwyjsezrn/Build/Products/Debug-iphonesimulator" "--log-level=debug"
INFO 2024-02-29 13:40:38.546873 +07:00 Issuing a command for Organization: test-6aq Project: apple-ios
But when I use sentry-cli
in my terminal. It showed more logs and successfully uploaded the debug symbol into sentry project
@williamsantoso93 thank you for this information. It looks like the reason for the shortened logs is that the uploading process, by default, occurs in the background when running in Xcode.
You should be able to get the full debug logs by modifying your run script to the following:
if which sentry-cli >/dev/null; then
export SENTRY_ORG=test-6aq
export SENTRY_PROJECT=apple-ios
sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" --log-level=debug --force-foreground
if [ ! $? -eq 0 ]; then
echo "warning: sentry-cli - $ERROR"
fi
else
echo "warning: sentry-cli not installed, install using 'brew install getsentry/tools/sentry-cli'"
fi
Please try again with the modified run script I suggested above and provide the logs you obtain.
@szokeasaurusrex Theses are the updated logs
INFO 2024-02-29 16:08:43.946604 +07:00 Loaded config from /Users/williamsantoso/Documents/Parkee/Project/Test sentry/.sentryclirc
DEBUG 2024-02-29 16:08:43.946804 +07:00 sentry-cli version: 2.28.6, platform: "darwin", architecture: "arm64"
INFO 2024-02-29 16:08:43.947413 +07:00 sentry-cli was invoked with the following command line: "sentry-cli" "debug-files" "upload" "--include-sources" "/Users/williamsantoso/Library/Developer/Xcode/DerivedData/Test_sentry-fczcdguhuxnypkegkhelwyjsezrn/Build/Products/Debug-iphonesimulator" "--log-level=debug" "--force-foreground"
INFO 2024-02-29 16:08:43.947452 +07:00 Issuing a command for Organization: test-6aq Project: apple-ios
DEBUG 2024-02-29 16:08:43.950020 +07:00 request GET https://sentry.io/api/0/organizations/test-6aq/chunk-upload/
DEBUG 2024-02-29 16:08:43.950040 +07:00 using token authentication
DEBUG 2024-02-29 16:08:43.950057 +07:00 retry number 0, max retries: 0
DEBUG 2024-02-29 16:08:44.032901 +07:00 > GET /api/0/organizations/test-6aq/chunk-upload/ HTTP/1.1
DEBUG 2024-02-29 16:08:44.032919 +07:00 > Host: sentry.io
DEBUG 2024-02-29 16:08:44.032922 +07:00 > Accept: */*
DEBUG 2024-02-29 16:08:44.032924 +07:00 > Connection: TE
DEBUG 2024-02-29 16:08:44.032928 +07:00 > TE: gzip
DEBUG 2024-02-29 16:08:44.032930 +07:00 > User-Agent: sentry-cli/2.28.6
DEBUG 2024-02-29 16:08:44.033652 +07:00 > Authorization: Bearer 7fdfaeb9***
DEBUG 2024-02-29 16:08:44.435180 +07:00 < HTTP/1.1 200 OK
DEBUG 2024-02-29 16:08:44.435197 +07:00 < server: nginx
DEBUG 2024-02-29 16:08:44.435201 +07:00 < date: Thu, 29 Feb 2024 09:08:44 GMT
DEBUG 2024-02-29 16:08:44.435204 +07:00 < content-type: application/json
DEBUG 2024-02-29 16:08:44.435207 +07:00 < Content-Length: 339
DEBUG 2024-02-29 16:08:44.435210 +07:00 < allow: GET, POST, HEAD, OPTIONS
DEBUG 2024-02-29 16:08:44.435218 +07:00 < access-control-allow-methods: GET, POST, HEAD, OPTIONS
DEBUG 2024-02-29 16:08:44.435227 +07:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken
DEBUG 2024-02-29 16:08:44.435230 +07:00 < access-control-expose-headers: X-Sentry-Error, X-Sentry-Direct-Hit, X-Hits, X-Max-Hits, Endpoint, Retry-After, Link
DEBUG 2024-02-29 16:08:44.435234 +07:00 < access-control-allow-origin: *
DEBUG 2024-02-29 16:08:44.435237 +07:00 < x-sentry-rate-limit-remaining: 199
DEBUG 2024-02-29 16:08:44.435239 +07:00 < x-sentry-rate-limit-limit: 200
DEBUG 2024-02-29 16:08:44.435242 +07:00 < x-sentry-rate-limit-reset: 1709197725
DEBUG 2024-02-29 16:08:44.435244 +07:00 < x-sentry-rate-limit-concurrentremaining: 199
DEBUG 2024-02-29 16:08:44.435246 +07:00 < x-sentry-rate-limit-concurrentlimit: 200
DEBUG 2024-02-29 16:08:44.435249 +07:00 < vary: Accept-Language, Cookie
DEBUG 2024-02-29 16:08:44.435251 +07:00 < content-language: en
DEBUG 2024-02-29 16:08:44.435258 +07:00 < x-frame-options: deny
DEBUG 2024-02-29 16:08:44.435263 +07:00 < x-content-type-options: nosniff
DEBUG 2024-02-29 16:08:44.435265 +07:00 < x-xss-protection: 1; mode=block
DEBUG 2024-02-29 16:08:44.435270 +07:00 < content-security-policy: media-src *; style-src 'unsafe-inline' *; base-uri 'none'; worker-src blob:; img-src blob: data: *; frame-ancestors 'self' *.sentry.io; font-src * data:; object-src 'none'; script-src 'self' 'unsafe-inline' 'report-sample' s1.sentry-cdn.com js.sentry-cdn.com browser.sentry-cdn.com statuspage-production.s3.amazonaws.com static.zdassets.com aui-cdn.atlassian.com connect-cdn.atl-paas.net js.stripe.com 'strict-dynamic' cdn.pendo.io data.pendo.io pendo-io-static.storage.googleapis.com pendo-static-5634074999128064.storage.googleapis.com; frame-src app.pendo.io demo.arcade.software js.stripe.com sentry.io; default-src 'none'; connect-src 'self' *.algolia.net *.algolianet.com *.algolia.io sentry.io *.sentry.io s1.sentry-cdn.com o1.ingest.sentry.io api2.amplitude.com app.pendo.io data.pendo.io reload.getsentry.net t687h3m0nh65.statuspage.io sentry.zendesk.com ekr.zdassets.com maps.googleapis.com; report-uri https://o1.ingest.sentry.io/api/54785/security/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=d113f40b0ac12df7a1c1cb079d8788289918997f
DEBUG 2024-02-29 16:08:44.435274 +07:00 < x-envoy-attempt-count: 1
DEBUG 2024-02-29 16:08:44.435276 +07:00 < x-envoy-upstream-service-time: 66
DEBUG 2024-02-29 16:08:44.435278 +07:00 < x-served-by: getsentry-web-default-common-production-96bd485f8-9xllh
DEBUG 2024-02-29 16:08:44.435284 +07:00 < x-served-by: frontend-default-5774859f-mff8d
DEBUG 2024-02-29 16:08:44.435287 +07:00 < strict-transport-security: max-age=31536000; includeSubDomains; preload
DEBUG 2024-02-29 16:08:44.435289 +07:00 < via: 1.1 google
DEBUG 2024-02-29 16:08:44.435292 +07:00 < Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
DEBUG 2024-02-29 16:08:44.435311 +07:00 response status: 200
DEBUG 2024-02-29 16:08:44.435319 +07:00 body: {"url":"organizations/test-6aq/chunk-upload/","chunkSize":8388608,"chunksPerRequest":64,"maxFileSize":2147483648,"maxRequestSize":33554432,"concurrency":8,"hashAlgorithm":"sha1","compression":["gzip"],"accept":["debug_files","release_files","pdbs","sources","bcsymbolmaps","il2cpp","portablepdbs","artifact_bundles","artifact_bundles_v2"]}
error: Operation not permitted (os error 1)
DEBUG 2024-02-29 16:08:44.436389 +07:00 skipping update nagger because session is not attended
warning: sentry-cli -
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure
@williamsantoso93 Thank you for the logs! It appears, based on the output, that the Sentry CLI is attempting to access files that it does not have permissions to access.
Perhaps, you might be able to fix the problem by adding the path where your dSYMs are stored to the Xcode run script's input file list, similar to how you added the .sentryclirc
?
@szokeasaurusrex I had added the dSYMs path into input files but I still had the same logs
@williamsantoso93 Could you try again, but this time add the entire {$DWARF_DSYM_FOLDER_PATH}/
directory to the input files, since that is the same directory you are passing to the Sentry CLI?
If you still observe the error after trying the above, would you able to post a minimal reproduction (in the form of an Xcode project where you observe the error) to GitHub, and share the link with me? I am having trouble creating a similar setup to yours where I observe this error, since I have only limited experience working with Xcode.
@szokeasaurusrex I have added hard coded path of {$DWARF_DSYM_FOLDER_PATH}/
but still get the same result.
This is my github repo for this project (https://github.com/williamsantoso93/Test-sentry).
Thank you @williamsantoso93, I was able to reproduce the error with the repo you provided. I will now try to determine why the error is occurring
@williamsantoso93, until we have a more permanent fix, I found that you can work around this issue by going to "Build Settings" and setting the "User Script Sandboxing" option to "No."
@SpaceGrey I will need more information on what you are referring to in order to help you with your problem.
The message can be sent, but none of the crash is sent.
What message are you talking about? What crash are you referring to?
Then I added the .sentryclirc to the input file, still did not work, then I changed all my targets' User Script Sandboxing to No, but still did not work.
What exactly is not working?
Then I try to add Sentry to my other project, and it works out of the box with every crash show on the website. I really have no idea what‘s going on.
What do you mean by adding Sentry to your project? Did you add the Sentry CLI to your build phase? Did you instrument your application with the Sentry SDK? These are different steps you need to take to get errors sent to Sentry properly.
Please consider opening a separate issue, where you fully describe what your problem is and how I can reproduce it. I would be happy to help you, but I can only help if I have enough information about your setup.
You can also read through our docs if you have more general questions.
docs Thank you. I found the reason, it turns out that I removed all files in the cache folder when the app booted up, after I removed this code, everything worked fine again.
Xcode 15 enabled ENABLE_USER_SCRIPT_SANDBOXING
by default. This also created other issues like https://github.com/getsentry/sentry-wizard/issues/569. Since https://github.com/getsentry/sentry-wizard/pull/574 fixed this recently, the wizard setup described in this issue should now work. @szokeasaurusrex
Environment
OS: macOS 14.1.2 sentry-cli: 2.28.6 Xcode: 15.2
Steps to Reproduce
brew install getsentry/tools/sentry-wizard && sentry-wizard -i ios
and followed the prompt.sentryclirc
from This InstructionExpected Result
Debug symbol successfully uploaded to sentry Project
Actual Result
Symbols aren't uploaded.
Logs
Unfortunately adding --log-level or exporting the env. variable do not produce any output.