sentry-unity icon indicating copy to clipboard operation
sentry-unity copied to clipboard

Sentry: (Error) Failed to resolve persistent installation ID. System.UnauthorizedAccessException: Access to the path "xxxxxxx" is denied.

Open ArnauKokoro opened this issue 2 years ago • 6 comments

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which version of the SDK? 0.23.1

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? 2020.3.13f

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? Android and iOS

Steps to Reproduce

Sentry Initialization Programmatically

Expected Result

No errors thrown

Actual Result

Sentry: (Error) Failed to resolve persistent installation ID. System.UnauthorizedAccessException: Access to the path "xxxxxx" is denied. Sentry: (Error) Failed to find an appropriate network interface for installation ID. -> This line JUST ON iOS

ArnauKokoro avatar Oct 11 '22 17:10 ArnauKokoro

Hey @ArnauKokoro, thanks for reporting this. I assume when you're initializing the SDK you're not setting the CacheDirectoryPath? It looks like the Session Tracking is at fault here. But the SDK should definitely not create errors due to this.

You could work around this error for now, by setting AutoSessionTracking = false.

bitsandfoxes avatar Oct 12 '22 08:10 bitsandfoxes

Hi @bitsandfoxes,

I'm not setting CacheDirectoryPath. What's happend if I disable AutoSessionTracking because I had it enabled on other SDK versions?

ArnauKokoro avatar Oct 12 '22 09:10 ArnauKokoro

I assumed your intention was to disable all offline caching. You could set the CacheDirectoryPath yourself, the SDK defaults to Application.PersistentDataPath.

If you disable AutoSessionTracking the SDK will no longer send information about release health i.e. crash-free rate e.t.c.

bitsandfoxes avatar Oct 12 '22 09:10 bitsandfoxes

Hi @bitsandfoxes

I see...I need that AutoSessionTracking.

So...to avoid that error I should add a CacheDirectoryPath? What's a normal CacheDirectoryPath for Android and iOS?

Many thanks!

ArnauKokoro avatar Oct 12 '22 09:10 ArnauKokoro

Hi @bitsandfoxes,

Got it fixed with this workaround:

What I did is set Application.temporaryCachePath as a CacheDirectoryPath on the programmatically initial options and keep AutoSessionTracking enabled.

With these options the error not occurs.

Thanks!

ArnauKokoro avatar Oct 12 '22 12:10 ArnauKokoro

Thanks for confirming the workaround.

bitsandfoxes avatar Oct 13 '22 11:10 bitsandfoxes

That this is failing for you is quite surprising to me though. As mentioned above, we set the default value to Application.persistentDataPath and this seems to work fine on all platforms. Can you confirm the path in the error you mentioned above (Sentry: (Error) Failed to resolve persistent installation ID. System.UnauthorizedAccessException: Access to the path "xxxxxx") looked like the path in the Unity docs for the given platform?

edit: I've missed this is because of the programmatic initialization - yeah, that makes sense and that's an issue we can do something about.

vaind avatar Oct 18 '22 10:10 vaind

Thanks again @ArnauKokoro. We're tracking this issue over here: https://github.com/getsentry/sentry-unity/issues/1025

bitsandfoxes avatar Oct 18 '22 15:10 bitsandfoxes