micromashor
05/24/2023, 6:03 PMSkye
05/24/2023, 6:04 PMmicromashor
05/24/2023, 6:04 PMSkye
05/24/2023, 6:04 PMmicromashor
05/24/2023, 6:05 PMmicromashor
05/24/2023, 6:20 PMmicromashor
05/24/2023, 6:29 PMmicromashor
05/24/2023, 6:46 PMskipLibCheckniezle.ziolko
05/24/2023, 7:21 PMzegevlier
05/24/2023, 7:27 PMzegevlier
05/24/2023, 7:27 PMbennycondon
05/25/2023, 1:53 AMwrangler pages dev ./src/functions --local on wrangler@2.20.0:
* I receive the output “No functions. Shimming…” and
* Each function responds with 404s.
I have no issues if I place my /functions folder at the root.nora
05/25/2023, 5:10 AMbennycondon
05/25/2023, 7:03 AMHardAtWork
05/25/2023, 7:13 AM/src/functions to /functions before deploy?stukennedy
05/25/2023, 8:34 AMstukennedy
05/25/2023, 8:41 AMwebsocket.ts endpoint and it almost seems to be setting up
typescript
async function handleSession(request: Request, websocket: WebSocket) {
websocket.accept();
websocket.addEventListener('message', async ({ data }) => {
websocket.send('<div>Some HTML</div>');
});
websocket.addEventListener('close', async (evt) => {
// Handle when a client closes the WebSocket connection
console.log(evt);
});
}
export const onRequest: PagesFunction = async ({ request }) => {
console.log('websocket');
const upgradeHeader = request.headers.get('Upgrade');
if (!upgradeHeader || upgradeHeader !== 'websocket') {
return new Response('Expected Upgrade: websocket', { status: 400 });
}
const [client, server] = Object.values(new WebSocketPair());
await handleSession(request, server);
return new Response(null, {
status: 101,
webSocket: client,
});
};
I get
websocket
A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished.
[mf:inf] GET /websocket 500 Internal Server Error (4ms)stukennedy
05/25/2023, 9:38 AMwebsocket.ts to _websocket.ts and added a check for any route that starts with '_' in my middleware, in those cases it just does a next()
I also needed to remove hx-boost from my app, this is HTMX that does some fancy dynamic page fetching stuff. I've got it working locally now, let's see if I can get it working on Cloudflare itself.micromashor
05/25/2023, 4:30 PM_worker.js file somewhere other than the output directory? I'm really not a fan of having all of the backend code exposed on the public site.Skye
05/25/2023, 4:39 PMmicromashor
05/25/2023, 4:40 PMmicromashor
05/25/2023, 4:40 PMSkye
05/25/2023, 4:40 PMmicromashor
05/25/2023, 4:41 PMnora
05/25/2023, 4:41 PMnora
05/25/2023, 4:42 PMpublic/
favicon.ico
functions/
index.ts
controllers/
getSomething.tsnora
05/25/2023, 4:42 PMnora
05/25/2023, 4:42 PMmicromashor
05/25/2023, 4:42 PM_worker.js file a shim e.g. export * from '../api/index.js'; right?Skye
05/25/2023, 4:43 PM