microsoft / playwright-testing-service

MIT License
83 stars 13 forks source link

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

Closed paradix86 closed 3 months ago

paradix86 commented 4 months ago

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

puagarwa commented 4 months ago

HI @parafix86, We checked our telemetry and found the request is genuine 401 failure due to token expiry being in past 03/08/2024 07:39:54, can you please generate new token from https://playwright.microsoft.com/ and try it again. please follow this link for reference https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

darshandp007 commented 4 months ago

Getting same issue with Playwright VSCode extension

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

puagarwa commented 4 months ago

Hi @darshandp007 , I looked into your request in our telemetry and it seems you are also hitting the genuine 401 issue because your access Key is expired (12/12/2023 04:26:51), please generate a new key by following this and try again. https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

darshandp007 commented 4 months ago

Hi @darshandp007 , I looked into your request in our telemetry and it seems you are also hitting the genuine 401 issue because your access Key is expired (12/12/2023 04:26:51), please generate a new key by following this and try again. https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

@puagarwa I'm using in my local not cloud service. And It was work perfectly 2 day's back. This extension: https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright

I think that's issue on latest(1.1.1) release of VSCode extension, It's woking fine with previous version.

puagarwa commented 4 months ago

Hi @darshandp007 , I looked into your request in our telemetry and it seems you are also hitting the genuine 401 issue because your access Key is expired (12/12/2023 04:26:51), please generate a new key by following this and try again. https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

@puagarwa I'm using in my local not cloud service. And It was work perfectly 2 day's back. This extension: https://marketplace.visualstudio.com/items?itemName=ms-playwright.playwright

I think that's issue on latest(1.1.1) release of VSCode extension, It's woking fine with previous version.

Hi @darshandp007 , Can you provide below info Are you using MPT service ? If yes, then please check the value of env variable PLAYWRIGHT_SERVICE_ACCESS_KEY and parse it in jwt.io and check expiry. if this is expired, please generate a new token and try it.

puagarwa commented 4 months ago

HI @parafix86, We checked our telemetry and found the request is genuine 401 failure due to token expiry being in past 03/08/2024 07:39:54, can you please generate new token from https://playwright.microsoft.com/ and try it again. please follow this link for reference https://learn.microsoft.com/en-us/azure/playwright-testing/how-to-manage-access-tokens

HI @paradix86 , Just checking if you get chance to check with new access key.

paradix86 commented 4 months ago

hey @puagarwa, Sorry for not being able before to give the feedback

Yes, that was the issue.

I honestly think that the error message can be improved, and I don't understand why if I'm running locally, playwright, if I have a playwright.service.config.ts in my project with an expired token ( PLAYWRIGHT_SERVICE_ACCESS_KEY ), you cannot even run local test. We were trying the "cloud" preview services a long time ago and honestly even forgot about that feature, but a local test must not fail for an expired token of a non-used service.

Is there already a feature request or bug opened about that?

puagarwa commented 4 months ago

HI @paradix86 , Our service usage is irrespective of local vs CI agent, customers do like to use the service even when running test from local.

However, if you are looking to control how to switch between running with service vs without service, there are two options

puagarwa commented 3 months ago

@paradix86 closing the issue. feel free to open issue if you need any help.