Comments (2)
I take it all back :) The module in middy
works just fine.
I copied the source of httpErrorHandler
to customise it for my app, and changed the import to an ES6 style instead of using require
:
import HttpError from 'http-errors';
// handler.error instanceof HttpError => false
The original looks like:
const { HttpError } = require('http-errors')
// handler.error instanceof HttpError => true
However if import createError
, then I can make the ES6 style import work:
import createError from 'http-errors';
// handler.error instanceof createError.HttpError => true
Which may indicate that either A) I don't know nodejs, B) I'm using Babel wrong or C) probably both.
If anyone has read this far, thanks for your time! 💯
from middy.
Hey @mafrosis, thanks for your time and for using middy :)
I have to say that these kind of errors with the new module syntax are normal, I spent a decent amount of time myself with similar issues when I started using them (and still I get something wrong from time to time), so don't be too hard on yourself!
I look forward to seeing your first contribution to this project!
from middy.
Related Issues (20)
- Not able to invoke the http-router routes from post-man using serverless-offiline HOT 4
- ERR_PACKAGE_PATH_NOT_EXPORTED error HOT 1
- index.d.ts still allows callback based handlers.
- dead links on getting started page HOT 1
- [middy/core] get event input in timeoutEarlyResponse parameter HOT 1
- Throws an error Error [ERR_PACKAGE_PATH_NOT_EXPORTED] HOT 1
- Restrict types to `APIGatewayProxyResultV2` or `APIGatewayProxyResult` HOT 2
- TypeScript compile error in @middy/core 5.2.4 HOT 7
- Lambda throwing `Failed to resolve internal values` in secretsManagerMiddlewareBefore HOT 3
- Simple lib import fails with both `tsx` and `ts-node` HOT 2
- LLRT Support
- TypeScript error when using `S3Handler` type HOT 3
- middy 5.2.5 isn't available on npm HOT 1
- Please give more descriptive error when throwing "Failed to resolve internal values" in secrets-manager module HOT 2
- middy/http-cors disable defaults and don't add headers HOT 1
- Streamified response with empty body ignores other response attributes HOT 3
- `http-error-handler` to support Problem Details (RFC 9457) HOT 1
- http-error-handler : set custom test to return error instead of `statusCode` HOT 2
- http-error-handler: guidance/bug on using lambda-authorizer with v5 HOT 1
- error-logger: Call implementation function with await prefix HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from middy.