microsoft / playwright-testing-service

MIT License
70 stars 10 forks source link

[BUG]:Error: browserType.connect: WebSocket error: wss://westeurope.api.playwright.microsoft.com/api/authorize/connectSession 401 Unauthorized #96

Closed AlanCodega closed 4 months ago

AlanCodega commented 4 months ago

Describe the bug Since yesterday we've having this error with EVERY spec file we run:

Error: browserType.connect: WebSocket error: wss://westeurope.api.playwright.microsoft.com/api/authorize/connectSession 401 Unauthorized Call log:

To Reproduce run any playwright test with vscode

Expected behavior not having this "generic" error

Screenshots image

Setup information (please complete the following information):

AB#1952828

vvs11 commented 4 months ago

Hi @AlanCodega Thanks for reaching out. This error could be because the Access Token you were using to authenticate with the service is expired or not set for this run. Could you check if the token is active and create a new token if it's expired? Here's the documentation: https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

AlanCodega commented 4 months ago

Hi @AlanCodega Thanks for reaching out. This error could be because the Access Token you were using to authenticate with the service is expired or not set for this run. Could you check if the token is active and create a new token if it's expired? Here's the documentation: https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

Hi @vvs11 , many thanks for your reply.

it's the 1st thing I thought. I've re-create the token following this guide: image

But still have the same issue, even if I want to run locally: image

puagarwa commented 4 months ago

HI @AlanCodega We checked our telemetry and it shows that token you are using is expired, one possibility is though you have generated new token but you havent updated it your system to pick new token value. Can you please check your environment variable once. You can actually check the token validatity via jwt.io , please confirm after this.

AlanCodega commented 4 months ago

HI @AlanCodega We checked our telemetry and it shows that token you are using is expired, one possibility is though you have generated new token but you havent updated it your system to pick new token value. Can you please check your environment variable once. You can actually check the token validatity via jwt.io , please confirm after this.

Hi @puagarwa, Many thanks for your reply.

i found the issue, and you have reason.

I updated the token following the guide using powershell commands, but we had an .env fine in our vs code. Once I've updated the token here, everything was run as before.

Many thanks for your help.