tail or if you have logpush enabled then they'll be in your storage
tail or if you have logpush enabled then they'll be in your storage

wrangler tail right?.json()properties.periods doesn't exist, for example..ok and also check if the content-type includes application/json. You'd be surprised at how many APIs are wonky sometimes and return a 200 but an HTML error page or something.properties doesn't exist there, you'll get a TypeError. I'd check proto_res.properties exists tooif(!proto_res?.properties?.periods) with optional chaining.properties.periods would throw a TypeError if properties doesn't exist. For example:
performance.now() isn’t available in Workers and Date.now() doesn’t increment unless you do I/O is there any way to actually benchmark CPU bound function execution times in a worker?performance.now() is available but it just calls Date.now()internal server error anyplace to look to see better logging?wrangler tail.json()properties.periods.okcontent-typeapplication/json.propertiesTypeErrorTypeErrorproto_res.propertiesif(!proto_res?.properties?.periods).properties.periodspropertiesperformance.now()performance.now()Date.now()Date.now()internal server error//get hourly weather
const wthr: Result<Period> = await (async () => {
const proto_res = (await (await fetch(`${WeatherAPIEndpoint}/hourly`, { body: null, method: 'GET', headers: fetch_headers})).json()) as WeatherData|undefined;
if (!exists(proto_res) || !exists(proto_res.properties.periods)) return new Err(`No data from ${WeatherAPIEndpoint}/hourly`);
const result = proto_res.properties.periods.filter(p => (dateIsoToUnixSec(p.startTime)*1000 > now))[0];
if (exists(result)) return new Ok(result);
return new Err("Data too old");
})();
if (!wthr.isOk()) return;
//get overall day dorcast
const day_forcase = await (async () => {
const proto_res = (await (await fetch(WeatherAPIEndpoint, { body: null, method: 'GET', headers: fetch_headers})).json()) as WeatherData|undefined;
if (!exists(proto_res) || !exists(proto_res.properties.periods)) return new Err(`No data from ${WeatherAPIEndpoint}`);
const result = proto_res.properties.periods.find(p => (p.number == 1));
if (exists(result)) return new Ok(result);
return new Err("Today's data not found");
})();[placement]
mode = "smart"if (!exists(proto_res) || !exists(proto_res.properties.periods)) return new Err(`No data from ${WeatherAPIEndpoint}/hourly`);const fetch_headers = {
'User-Agent': `${fitweather_credentials.name}/1.0 (Florida Institute of Technology Weather Discord Bot (Student Run), https://github.com/DaBigBlob/FIT-Weather-Chan)`,
'Accept': "application/geo+json"
};export function exists<T>(data: T|null|undefined): data is T {
if (
(data === null) ||
(data === undefined)
) return false;
return true;
}const obj = {foo: 'bar'}
console.log(obj.foo) // bar
console.log(obj.bar) // undefined
console.log(obj.bar.baz) // TypeErrorimport { Hono } from 'hono'
import { Client } from 'pg'
const app = new Hono()
const connstring = "postgresql://postgres@localhost:5432/hhscdev?schema=public"
app.get('*', async (c) => {
const client = new Client("postgresql://postgres@localhost:5432/hhscdev?schema=public");
await client.connect();
const { rows: [{ now }] } = await client.query('select now();');
return c.text(`Hello Hono! ${now}`)
})
export default app