JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.41k stars 2.38k forks source link

Oh-My-Posh debug shows Authorization Error on Athlete #2041

Closed hachi1030-Allen closed 2 years ago

hachi1030-Allen commented 2 years ago

Code of Conduct

What happened?

I am using scoop to install the latest oh-my-posh, so it's not the PowerShell module.

The loading time reduced but still I need around 2000ms to load the PowerShell profile. After running the measure-script function from PSProfiler module on the my Profile.ps1 file, I got that this line took the most of the time.

image

Then I run the oh-my-posh debug command and found one HTTP request error which took around 700ms to complete, but the result is Authorization Error.

image

May I know what's this call for and if we figured out how to resolve the Authorization issue, whether oh-my-posh init will run faster?

Hope can get help from here. Thanks in advance!

Theme

larserikfinholt.omp.json

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell

Log output

 allliu    ~  ﮫ62ms⠀   oh-my-posh debug

Version: 7.59.1

Segments:

ConsoleTitle(true)   -   0 ms - pwsh in ~
session(true)        -   0 ms -  allliu 
path(true)           -   0 ms -    ~
git(false)           -   1 ms -
executiontime(true)  -   0 ms -  ﮫ0ms⠀
strava(false)        - 640 ms -
exit(true)           -   4 ms -   

Run duration: 648.364ms

Cache path: C:\Users\allliu\AppData\Local\oh-my-posh

Logs:

2022/04/06 10:21:52 Flags duration: 0s, args:
2022/04/06 10:21:52 Flags duration: 0s, args:
2022/04/06 10:21:52 debug: Getenv

2022/04/06 10:21:52 Getenv duration: 0s, args: OMP_CACHE_DISABLED
2022/04/06 10:21:52 Root duration: 103.3µs, args:
2022/04/06 10:21:52 Shell duration: 0s, args:
2022/04/06 10:21:52 ErrorCode duration: 0s, args:
2022/04/06 10:21:52 IsWsl duration: 0s, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 PathSeparator duration: 0s, args:
2022/04/06 10:21:52 PathSeparator duration: 0s, args:
2022/04/06 10:21:52 debug: User
allliu
2022/04/06 10:21:52 User duration: 0s, args:
2022/04/06 10:21:52 debug: Host
MS14848210
2022/04/06 10:21:52 Host duration: 0s, args:
2022/04/06 10:21:52 GOOS duration: 0s, args:
2022/04/06 10:21:52 TemplateCache duration: 103.3µs, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 debug: Getenv

2022/04/06 10:21:52 Getenv duration: 0s, args: SSH_CONNECTION
2022/04/06 10:21:52 debug: Getenv

2022/04/06 10:21:52 Getenv duration: 0s, args: SSH_CLIENT
2022/04/06 10:21:52 TemplateCache duration: 0s, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 Flags duration: 0s, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 GOOS duration: 0s, args:
2022/04/06 10:21:52 GOOS duration: 0s, args:
2022/04/06 10:21:52 PathSeparator duration: 0s, args:
2022/04/06 10:21:52 PathSeparator duration: 0s, args:
2022/04/06 10:21:52 PathSeparator duration: 0s, args:
2022/04/06 10:21:52 GOOS duration: 0s, args:
2022/04/06 10:21:52 IsWsl duration: 0s, args:
2022/04/06 10:21:52 StackCount duration: 0s, args:
2022/04/06 10:21:52 TemplateCache duration: 0s, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 GOOS duration: 0s, args:
2022/04/06 10:21:52 HasCommand duration: 1.7497ms, args: git.exe
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 error: HasParentFilePath
CreateFile C:\.git: The system cannot find the file specified.
2022/04/06 10:21:52 HasParentFilePath duration: 0s, args: .git
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:52 ExecutionTime duration: 0s, args:
2022/04/06 10:21:52 TemplateCache duration: 0s, args:
2022/04/06 10:21:52 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:52 Pwd duration: 0s, args:
2022/04/06 10:21:52 debug: Home
C:\Users\allliu
2022/04/06 10:21:53 debug: HTTPRequest
{"message":"Authorization Error","errors":[{"resource":"Athlete","field":"access_token","code":"invalid"}]}
2022/04/06 10:21:53 HTTPRequest duration: 632.3641ms, args: https://www.strava.com/api/v3/athlete/activities?page=1&per_page=1
2022/04/06 10:21:53 debug: Pwd
C:\Users\allliu
2022/04/06 10:21:53 Pwd duration: 0s, args:
2022/04/06 10:21:53 debug: Home
C:\Users\allliu
2022/04/06 10:21:53 ErrorCode duration: 0s, args:
2022/04/06 10:21:53 TemplateCache duration: 0s, args:
2022/04/06 10:21:53 TemplateCache duration: 0s, args:
2022/04/06 10:21:53 debug: Getenv
C:\Users\allliu\AppData\Local
2022/04/06 10:21:53 Getenv duration: 0s, args: LOCALAPPDATA
2022/04/06 10:21:53 CachePath duration: 170.5µs, args:
JanDeDobbeleer commented 2 years ago

@hachi1030-Allen hey. That theme has a Strava segment. If you're not using it, removing it is the best solution. If you want to use it, you need to authenticate 😁

hachi1030-Allen commented 2 years ago

Thanks @JanDeDobbeleer

In that case, I think we can close that, certainly I am not going to use Strava segment, so I will just switch a theme or ignore this error.

And seems it doesn't relate to the loading time.

Thanks so much for the quick response!

github-actions[bot] commented 9 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.