# Working fine offline, failing in aws lambda

**URL:** <https://forum.serverless.com/t/working-fine-offline-failing-in-aws-lambda/3261>\
**Category:** Serverless Framework\
**Tags:** aws\
**Created:** [December 6, 2017, 6:27am UTC](https://forum.serverless.com/t/working-fine-offline-failing-in-aws-lambda/3261 "2017-12-06T06:27:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andromelus](https://avatars.discourse-cdn.com/v4/letter/a/8797f3/32.png) [@Andromelus](https://forum.serverless.com/u/Andromelus)\
**Post date:** [December 6, 2017, 6:27am UTC](https://forum.serverless.com/t/working-fine-offline-failing-in-aws-lambda/3261/1 "2017-12-06T06:27:55Z")

</div>

Hello.

I want to make an AWS lambda using serverless framework.

In my project, I use the web3 node module.  
This is how I import it:  
`const Web3 = require('web3');`

And I mostly use it this way:  
`var web3 = new Web3(new Web3.providers.HttpProvider('http://<IP_VALUE>:<PORT_VALUE>'));`

When running this with sls offline, everything works fine and as expected. However, when uploading to lambda using `sls deploy`, I get the following error:

```
TypeError: Cannot read property 'HttpProvider' of undefined
    at getNode (/var/task/web3.js:62:43)

```

Any clue of what is doing that, why and how I can solve this?

---

<div class="post-metadata">

**Author:** ![JamesKnippel](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@JamesKnippel](https://forum.serverless.com/u/JamesKnippel)\
**Post date:** [June 18, 2018, 7:21pm UTC](https://forum.serverless.com/t/working-fine-offline-failing-in-aws-lambda/3261/2 "2018-06-18T19:21:46Z")

</div>

Have you found a solution to this? I too am encountering the same problem in Firebase Cloud Functions.
