when app url is websocket we still need to send to http schema not ws (#439)

* when app url is websocket we still need to send to http schema not ws

* fix bug from a previous PR
This commit is contained in:
Dave Horton
2025-05-08 13:41:36 -04:00
committed by GitHub
parent 2b4b3056e9
commit 48e39f37d3
2 changed files with 12 additions and 5 deletions

View File

@@ -12,8 +12,16 @@ const validateAppEnvSchema = (schema) => {
//Currently this request is not signed with the webhook secret as it is outside an account
const fetchAppEnvSchema = async(logger, url) => {
// Translate WebSocket URLs to HTTP equivalents (case-insensitive)
let fetchUrl = url;
if (url.toLowerCase().startsWith('ws://')) {
fetchUrl = 'http://' + url.substring(5);
} else if (url.toLowerCase().startsWith('wss://')) {
fetchUrl = 'https://' + url.substring(6);
}
try {
const response = await fetch(url, {
const response = await fetch(fetchUrl, {
method: 'OPTIONS',
headers: {
Accept: 'application/json'

7
package-lock.json generated
View File

@@ -2129,10 +2129,9 @@
}
},
"node_modules/@jambonz/speech-utils": {
"version": "0.2.7",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.7.tgz",
"integrity": "sha512-cV3RAp3sTchnYy9w0gaAyP2GlmscsMIt3TlcI/7GrTE1DNh7BNMLoQZeo1WprM9w4etVPMCu561O1O/bRlP+gg==",
"license": "MIT",
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.8.tgz",
"integrity": "sha512-3MyqNunI3vTYl1np/qyn3b/27dq8Jm8BOC4gARnjMR+40590DAfH3IR1P7gTC2kHbzUMTB8fGY26KLHvmapSSA==",
"dependencies": {
"@aws-sdk/client-polly": "^3.496.0",
"@aws-sdk/client-sts": "^3.496.0",