nitrictech/nitric

Too big request header

chimon2000 opened this issue ยท 8 comments

Bug Report

Issue

When running the app generated from the TypeScript Example, I get a "Too big request header" error.

Steps

Steps to reproduce the behavior:

  1. Generate application using CLI
  2. Run application
  3. Attempt to hit hello endpoint

Expected

I would expect the response to match the tutorial response.

Output of nitric info -o yaml:

{
  "os": "darwin",
  "arch": "arm64",
  "goVersion": "go1.19.13",
  "cliVersion": "1.33.4",
  "fabricVersion": "0.35.0",
  "containerRuntime": "docker",
  "containerRuntimeVersion": "platform:\n  name: Docker Engine - Community\ncomponents:\n- name: Engine\n  version: 24.0.7\n  details:\n    ApiVersion: \"1.43\"\n    Arch: arm64\n    BuildTime: \"2023-10-26T09:08:17.000000000+00:00\"\n    Experimental: \"false\"\n    GitCommit: 311b9ff\n    GoVersion: go1.20.10\n    KernelVersion: 6.5.10-orbstack-00110-gbcfe04c86d2f\n    MinAPIVersion: \"1.12\"\n    Os: linux\n- name: containerd\n  version: v1.7.7\n  details:\n    GitCommit: 8c087663b0233f6e6e2f4515cee61d49f14746a8\n- name: runc\n  version: 1.1.9\n  details:\n    GitCommit: 82f18fe0e44a59034f3e1f45e475fa5636e539aa\n- name: docker-init\n  version: 0.19.0\n  details:\n    GitCommit: de40ad0\nversion: 24.0.7\napiversion: \"1.43\"\nminapiversion: \"1.12\"\ngitcommit: 311b9ff\ngoversion: go1.20.10\nos: linux\narch: arm64\nkernelversion: 6.5.10-orbstack-00110-gbcfe04c86d2f\nexperimental: false\nbuildtime: \"2023-10-26T09:08:17.000000000+00:00\"\n",
  "detectedErrors": []
}

Other info

node -v
v20.10.0

This issue appears to happen regardless of the starter. I can verify that it's the same for the JS/Python starters.

Hey @chimon2000, I was unable to reproduce the error following your method. I'm also running an Apple silicon and have the same CLI and Node version. I've seen the error in the past, but updated the max header size in this PR and haven't seen the error since. Is there anything you may have done in your request that would push the request above the 8096 byte threshold?

No, in this case I am just hitting the end point through the nitric dashboard. I've also tried hitting the endpoint from the browser with the same effect.

I can reproduce with headers > 8096 bytes. Do you have an authorization token or similar that might be sent with the request? You can view the previous requests (and the headers that were sent) in the history tab below the response.
Screen Shot 2023-12-27 at 11 05 37 am

In my case, I have removed all of the headers and still get the header.

nitric.mp4

And here's the app code

import { api } from "@nitric/sdk";

// each API needs a unique name
const galaxyApi = api("far-away-galaxy-api");

galaxyApi.get("/moon", async ({ req, res }) => {
  res.body = "that's no moon, it's a space station.";
});

Still not able to reproduce but I was able to find the cause for your issue. I have opened up a new PR. If you have the time to test it out, you can follow the steps below:

git clone https://github.com/nitrictech/cli.git nitric-cli
cd nitric-cli
git checkout header-size
make

This will create the binary in ./bin/nitric which should hopefully fix your issue. Alternatively, this update will be in the next CLI release and I can let you know when it's available.

Yes, it looks like your fix solved my issue.

Awesome! Thanks for opening this up, we'll make sure this gets out in our next release ๐Ÿ‘