jeremydaly / jeremydaly/lambda-api
Returning Error to clients
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 127
- Avg merge
- 31m
- Merged PRs (30d)
- 2
Description
Hey Jeremy,
First of all thanks for the amazing framework.
I'm struggling here regarding returning error to clients, like 404 not found.
If i use the framework error engine this way: res.status(404).error('Not found')
Then in clients like Chrome we always get the bellow cors issue:
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled
And belive me i have all the cors stuff in the right place.
In the other hand if i use this way: res.status(404).json('Not found')
Then everthing is fine, i got a 404 in Chrome
I'm i doing something wrong ?
Thanks in advance,
Luiz
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source files or tests are named. Start by reproducing the difference between res.status(404).error('Not found') and res.status(404).json('Not found') in the framework's AWS/serverless API context, then inspect how each response handles CORS; done means identifying whether the error path is misconfigured or needs a framework change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100