Commit activity
Last 12 weeks · 0 commits
Community health
2 of 6 standards met
Recent PRs & issues
Fixes an unhandled promise rejection when a handler throws after it has already started writing the response. Problem always calls , which sets . If the handler already called , the headers are sent and throws . The throw happens inside the of , so the promise from rejects with nothing to handle it. On current Node.js versions an unhandled rejection terminates the process. Changes checks . When the headers are already sent, it can't send an error response, so it destroys the connection unless the response has ended. The client sees a failed request instead of a truncated body that looks complete. Adds a test that throws after and asserts that resolves. Testing Before the change, the new test fails with reported as an unhandled rejection. After the change, all three suites pass.
Fixes a request that never completes when a handler throws or rejects with a value that is not an . Problem only answers errors that pass . If a handler throws a string, a plain object, or rejects with a non- value, the branch does nothing. No response is sent and the client waits until it times out. Changes now always calls . A non- value is wrapped in an that includes the inspected value, so the client gets a 500 and the server logs the stack. Adds two tests: a synchronous of a string and a with a plain object. Testing Before the change, both new tests fail with a network timeout. After the change, all three suites pass.
Recent fixes
Summary add pnpm workspace configuration with minimum release age and approved build scripts pin pnpm 10.33.0 via packageManager and replace Yarn commands in scripts/CI replace yarn.lock with pnpm-lock.yaml and update CI to Node 20 make the test workspace depend on the local package via Testing
Access to XMLHttpRequest at 'http://localhost:3000/domains/xxx/records' from origin 'null' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response. I wrote the following code on the server side, but it didn't work! And the output: (node:26284) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
const express = require("express"); const cors = require("cors"); const dotenv = require("dotenv"); const paymentRoutes = require("./Routes/payment"); const app = express(); dotenv.config(); app.use(express.json()); app.use(cors()); app.options('', cors()); app.use( cors({ origin: true, optionsSuccessStatus: 200, credentials: true, }) ); app.options( '', cors({ origin: true, optionsSuccessStatus: 200, credentials: true, }) ); app.use("/api/payment/", paymentRoutes); // const corsOrigin ={ // origin:'http://localhost:3000', //or whatever port your frontend is using // optionSuccessStatus:200, // methods: "GET, POST" // } // app.use(cors(corsOrigin)); // app.use(cors()); // app.get("/", (req,res)=>{ // res.send("server working"); // }); const port = process.env.PORT 5001; app.listen(port, () => console.log());
Repository: vercel/micro. Description: Asynchronous HTTP microservices Stars: 10625, Forks: 453. Primary language: TypeScript. Languages: TypeScript (82.3%), JavaScript (17.7%). License: MIT. Topics: async, await, micro, microservice, vercel. Latest release: 10 (3y ago). Open PRs: 6, open issues: 5. Last activity: 5mo ago. Community health: 62%. Top contributors: leo, greenkeeper[bot], timneutkens, rauchg, floatdrop, greenkeeperio-bot, Qix-, leerob, fmiras, nkzawa and others.