question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Request error with Oak

See original GitHub issue

I’m trying to implement Aleph into an existing Oak server but am blocked by react.development.js requests coming back invalid.

import { Application as Oak } from "https://deno.land/x/oak/mod.ts";
import { Application, Server } from "https://deno.land/x/aleph/server/mod.ts";
import { localProxy } from "https://deno.land/x/aleph/server/localproxy.ts";
import { serve } from "https://deno.land/std@0.91.0/http/server.ts";

localProxy(8080);

const port = 1337;
const hostname = "localhost";
const oak = new Oak();
const app = new Application(".", "development", false);
const server = new Server(app);

oak.use(async (ctx) => {
  await server.handle(ctx.request.serverRequest as any);
});
await oak.listen({ port });

//let s = serve({ port, hostname });
//for await (const r of s) {
//  server.handle(r as any);
//}

image

Looks like the full file isn’t being returned for some reason. Oak on top, std on bottom image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
shadowtime2000commented, Apr 8, 2021

@aadamsx The /api directory is for serverless functions, like NextJS

1reaction
shadowtime2000commented, Apr 8, 2021

@aadamsx So, we are probably going to support having Aleph for full stack - but it is much more performant and organized to seperate the frontend and the backend. That allows you to modify them seperately without getting bogged down on tooling that combines then and since the frontend would either use static files or serverless functions which are fast, the frontend would be fast and not limited by the overhead of serving static files with a normal server.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Crash while trying to resolve the request body #410 - GitHub
I solved it! The error wasn't caused by oak but by the order of middleware. Before, causing error: app.
Read more >
Frequently Asked Questions | oak - GitHub Pages
Specifically error messages like Http - connection closed before message completed can occur when responding to requests where the connection drops before Deno ......
Read more >
Deno Oak middleware to handle all errors | The JS runtimes
A middleware error handler would catch all the errors raised by the Oak framework / application code. It'd then respond to the client...
Read more >
Deno oak v10.5.1 context.cookies never being set
When attempting to set cookies in oak, the cookies property of the context is never changed and the value is always returned undefined...
Read more >
oak@v5.2.0 - Deno
Currently oak supports request body types of JSON, text and URL encoded form data. ... the request will be rejected with a 415...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found