@swaaWu2YQ I have tried the exact same code on my test site and it works. But you get to the error as that API does not accept request from your domain:
Nov 28, 03:55:38 PM: b5fd6dea INFO {
url: 'https://api.weather.gov/points/39.7456,-97.0892',
headers: HeadersList {
cookies: null,
[Symbol(headers map)]: Map(1) { 'access-control-allow-origin' => [Object] },
[Symbol(headers map sorted)]: null
},
error: TypeError: fetch failed
at Object.fetch (node:internal/deps/undici/undici:11576:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.hello_default (file:///var/task/hello.mjs:15:18)
at async Runtime.handler (file:///var/task/___netlify-bootstrap.mjs:1851:15)
at async Runtime.handleOnceStreaming (file:///var/runtime/index.mjs:1206:26) {
cause: Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: com-200--poetic-pothos-6eab9b.netlify.app. is not in the cert's altnames: DNS:weather.gov, DNS:airquality.weather.gov, DNS:alerts-v2.weather.gov, DNS:alerts.weather.gov, DNS:amdar.ncep.noaa.gov, DNS:amdar.noaa.gov, DNS:api-v1.weather.gov, DNS:api.weather.gov, DNS:aviationweather.gov, DNS:cfs.ncep.noaa.gov, DNS:digital.weather.gov, DNS:f1.weather.gov, DNS:forecast-v3.weather.gov, DNS:forecast.weather.gov, DNS:gisc-washington.ncep.noaa.gov, DNS:graphical.weather.gov, DNS:hads.ncep.noaa.gov, DNS:hysplit.ncep.noaa.gov, DNS:inws.ncep.noaa.gov, DNS:iris.ncep.noaa.gov, DNS:madis-data.ncep.noaa.gov, DNS:madis.ncep.noaa.gov, DNS:madis.noaa.gov, DNS:mag.ncep.noaa.gov, DNS:magpara.ncep.noaa.gov, DNS:marine.weather.gov, DNS:mobile.weather.gov, DNS:nomads.ncep.noaa.gov, DNS:nomads.weather.gov, DNS:nws.weather.gov, DNS:opengeo.ncep.noaa.gov, DNS:preview-alerts.weather.gov, DNS:preview-api.weather.gov, DNS:preview-forecast-v3.weather.gov, DNS:preview-forecast.weather.gov, DNS:preview-idp.weather.gov, DNS:preview-idpgis.ncep.noaa.gov, DNS:preview-marine.weather.gov, DNS:preview-opengeo.ncep.noaa.gov, DNS:preview-ra4-gifs.weather.gov, DNS:preview-radar.weather.gov, DNS:preview-spot.weather.gov, DNS:preview.weather.gov, DNS:products.weather.gov, DNS:ptwc.weather.gov, DNS:ra4-gifs.weather.gov, DNS:radar-v2.weather.gov, DNS:radar.weather.gov, DNS:radar2pub.ncep.noaa.gov, DNS:radar3pub.ncep.noaa.gov, DNS:ripcurrents.noaa.gov, DNS:rsmc.ncep.noaa.gov, DNS:ssd.wrh.noaa.gov, DNS:test-nomads.ncep.noaa.gov, DNS:tsunami.gov, DNS:w1.weather.gov, DNS:w2.weather.gov, DNS:water.weather.gov, DNS:www.aviationweather.gov, DNS:www.cpcpara.ncep.noaa.gov, DNS:www.lib.ncep.noaa.gov, DNS:www.ncep.noaa.gov, DNS:www.nco.ncep.noaa.gov, DNS:www.ndsc.ncep.noaa.gov, DNS:www.nws.noaa.gov, DNS:www.opah.ncep.noaa.gov, DNS:www.prh.noaa.gov, DNS:www.ripcurrents.noaa.gov, DNS:www.srh.noaa.gov, DNS:www.tsunami.gov, DNS:www.tsunami.noaa.gov, DNS:www.vwt.ncep.noaa.gov, DNS:www.weather.gov, DNS:www.wrh.noaa.gov, DNS:wwwx.wrh.noaa.gov
at new NodeError (node:internal/errors:405:5)
at Object.checkServerIdentity (node:tls:337:12)
at TLSSocket.onConnectSecure (node:_tls_wrap:1610:27)
at TLSSocket.emit (node:events:517:28)
at TLSSocket._finishInit (node:_tls_wrap:1017:8)
at ssl.onhandshakedone (node:_tls_wrap:803:12) {
reason: "Host: com-200--poetic-pothos-6eab9b.netlify.app. is not in the cert's altnames: DNS:weather.gov, DNS:airquality.weather.gov, DNS:alerts-v2.weather.gov, DNS:alerts.weather.gov, DNS:amdar.ncep.noaa.gov, DNS:amdar.noaa.gov, DNS:api-v1.weather.gov, DNS:api.weather.gov, DNS:aviationweather.gov, DNS:cfs.ncep.noaa.gov, DNS:digital.weather.gov, DNS:f1.weather.gov, DNS:forecast-v3.weather.gov, DNS:forecast.weather.gov, DNS:gisc-washington.ncep.noaa.gov, DNS:graphical.weather.gov, DNS:hads.ncep.noaa.gov, DNS:hysplit.ncep.noaa.gov, DNS:inws.ncep.noaa.gov, DNS:iris.ncep.noaa.gov, DNS:madis-data.ncep.noaa.gov, DNS:madis.ncep.noaa.gov, DNS:madis.noaa.gov, DNS:mag.ncep.noaa.gov, DNS:magpara.ncep.noaa.gov, DNS:marine.weather.gov, DNS:mobile.weather.gov, DNS:nomads.ncep.noaa.gov, DNS:nomads.weather.gov, DNS:nws.weather.gov, DNS:opengeo.ncep.noaa.gov, DNS:preview-alerts.weather.gov, DNS:preview-api.weather.gov, DNS:preview-forecast-v3.weather.gov, DNS:preview-forecast.weather.gov, DNS:preview-idp.weather.gov, DNS:preview-idpgis.ncep.noaa.gov, DNS:preview-marine.weather.gov, DNS:preview-opengeo.ncep.noaa.gov, DNS:preview-ra4-gifs.weather.gov, DNS:preview-radar.weather.gov, DNS:preview-spot.weather.gov, DNS:preview.weather.gov, DNS:products.weather.gov, DNS:ptwc.weather.gov, DNS:ra4-gifs.weather.gov, DNS:radar-v2.weather.gov, DNS:radar.weather.gov, DNS:radar2pub.ncep.noaa.gov, DNS:radar3pub.ncep.noaa.gov, DNS:ripcurrents.noaa.gov, DNS:rsmc.ncep.noaa.gov, DNS:ssd.wrh.noaa.gov, DNS:test-nomads.ncep.noaa.gov, DNS:tsunami.gov, DNS:w1.weather.gov, DNS:w2.weather.gov, DNS:water.weather.gov, DNS:www.aviationweather.gov, DNS:www.cpcpara.ncep.noaa.gov, DNS:www.lib.ncep.noaa.gov, DNS:www.ncep.noaa.gov, DNS:www.nco.ncep.noaa.gov, DNS:www.ndsc.ncep.noaa.gov, DNS:www.nws.noaa.gov, DNS:www.opah.ncep.noaa.gov, DNS:www.prh.noaa.gov, DNS:www.ripcurrents.noaa.gov, DNS:www.srh.noaa.gov, DNS:www.tsunami.gov, DNS:www.tsunami.noaa.gov, DNS:www.vwt.ncep.noaa.gov, DNS:www.weather.gov, DNS:www.wrh.noaa.gov, DNS:wwwx.wrh.noaa.gov",
host: 'com-200--poetic-pothos-6eab9b.netlify.app',
cert: [Object],
code: 'ERR_TLS_CERT_ALTNAME_INVALID'
}
}
}
Can you share the code you are trying to execute?