@郭銍恩 I think you are referring to sample on this repo.
Looking at this sample, i see the env file is only updated with Azure OpenAI endpoint and speech region but the speech endpoint and keys are taken as input in either the HTML page or the env file. So, whenever the current project is sending a request it does not send the correct token for the correct speech endpoint to authenticate and get a response. I think this is what is causing the above error with the speech SDK.
Looking at the same repo, the commit history shows the option to enter the speech keys and region if you use Azure speech SDK but the current sample does not have this option. See the commit history here. The code at this point also uses the keys & region of speech service if the option to use Azure speech is selected from the HTML.
You might want to clone the code from above point and retry or raise an issue on the SDK for JS repo to correct the sample to use the correct configuration for speech resource. Thanks!!
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.