question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serverless example doesn't work

See original GitHub issue

Describe the bug Wrapped app.handler inside the serverless-http default export just like the example did but got an error.

TypeError: Cannot read property 'settings' of undefined
    at handler (...\node_modules\@tinyhttp\app\dist\index.cjs:287:37)
    at ...\node_modules\serverless-http\lib\framework\get-framework.js:9:5
    at ...\node_modules\serverless-http\serverless-http.js:19:28

To Reproduce

exports.handler = serverless(app.handler)

Versions

  • node: 12.x (serverless)
  • @tinyhttp/app: 1.1.11

Additional context

Works if I wrap express app inside serverless

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
talentlessguycommented, Feb 17, 2021

@ahmad-reza619 looks like your workaround works, then I will update the example and close the issue

1reaction
ahmad-reza619commented, Feb 17, 2021

Hi there, i believe this has to do with where the function is called, you can refer more explanation here

CMIIW but I think the workaround is like this

exports.handler = serverless(app.handler.bind(app))
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Troubleshoot Serverless API's
But this doesn't provide us all the info we need if our API begins to ... For example, if we have Lambda functions...
Read more >
Top 10 Serverless Deployment Errors (and How to Fix Them)
Alternatively, you can open the AWS Console, navigate to CloudFormation, and find the failed stack in your Stacks list: In the case of...
Read more >
Serverless example doesn't work · Issue #222 - GitHub
Describe the bug Wrapped app.handler inside the serverless-http default export just like the example did but got an error.
Read more >
Why does my Serverless Function work locally but not when ...
One of the common reasons for different behavior across environments is whether or not your Serverless Functions depend on packages with native dependencies....
Read more >
serverless: function doesn't exist in this service - Stack Overflow
Your template is invalid. You can't just put your function under an arbitrary node to tell the framework that it applies to some...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found