jeremydaly / jeremydaly/lambda-api

CORS issues , preflight is working

Open
#194 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.5k
Forks
127
Avg merge
31m
Merged PRs (30d)
2

Description

i tried all method , but still exist cors issue,
in my case preflight connection working properly it returns 200
But actual response fail

here , my code is
`const app = require("lambda-api")();
app.use((req, res, next) => {
res.cors();
next();
});
app.get("/connect", async (req, res) => {
return res.send({ status: "testing" });
});

app.options("/*", (req, res) => {
res.cors();
return res.status(200).json({});
});
module.exports.connect = async (event, context) => {
return await app.run(event, context);
};`

@btakita
thank you

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported app with the /connect route, middleware res.cors(), and the app.options("/*") handler. Inspect the actual response headers from the request after a successful preflight and compare them with the expected CORS headers. Done means the actual response succeeds cross-origin, not only the preflight.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.