Closed bhirsch42 closed 7 years ago
Hi @bhirsch42 we are looking in to this now and trying to recreate the issue. Will update you once we fixed it.
@bhirsch42 Have you installed a previous version of serverless (serverelss_v1) globally in your machine? Could you please check the current serverless version with 'serverless -v' command and let me know.
The first time I performed a global serverless install was with yarn a couple weeks ago.
Here's the result of running sls -v
:
11:22 $ sls -v
1.0.3
@bhirsch42 I still couldn't recreate this issue. My environment is,
git --version
git version 1.9.5.msysgit.1
node --version
v6.3.0
npm --version
3.10.6
@rehrumesh @AshanFernando Could you recreate the above issue?
However I found couple of S/O questions regarding similar issues. According to that, you should have a branch named 'serverless_v1' and also a file or a directory named 'serverless_v1', and that caused this problem.
Ran into the same issue here. I was able to get past this by modifying serverless-react-boilerplate/serverless/package.json. I changed the line:
"serverless-offline": "git+https://github.com/dherault/serverless-offline.git/#serverless_v1",
to:
"serverless-offline": "git+https://github.com/dherault/serverless-offline.git",
Thank you all so much for the help. @mypalmike's change made everything install perfectly!
Now I'm just having a problem where, even though I've populated serverless/.env
with my AWS credentials, I'm still getting a missing credentials error:
{ TimeoutError: Missing credentials in config
at ClientRequest.<anonymous> (/Users/benhirsch/Github/serverless-react-boilerplate/serverless/node_modules/aws-sdk/lib/http/node.js:56:34)
at ClientRequest.g (events.js:286:16)
at emitNone (events.js:86:13)
at ClientRequest.emit (events.js:185:7)
at Socket.emitTimeout (_http_client.js:614:10)
at Socket.g (events.js:286:16)
at emitNone (events.js:86:13)
at Socket.emit (events.js:185:7)
at Socket._onTimeout (net.js:333:8)
at tryOnTimeout (timers.js:232:11)
at Timer.listOnTimeout (timers.js:202:5)
message: 'Missing credentials in config',
code: 'CredentialsError',
time: 2016-10-25T02:12:47.822Z,
retryable: true,
originalError:
{ message: 'Could not load credentials from any providers',
code: 'CredentialsError',
time: 2016-10-25T02:12:47.822Z,
retryable: true,
originalError:
{ message: 'Connection timed out after 1000ms',
code: 'TimeoutError',
time: 2016-10-25T02:12:47.821Z,
retryable: true } } }
Credentials Error --------------------------------------
Missing credentials in config
For debugging logs, run again after setting SLS_DEBUG env var.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Please report this error. We think it might be a bug.
Your Environment Infomation -----------------------------
OS: darwin
Node Version: 6.4.0
Serverless Version: 1.0.3
Any ideas why that might be happening?
Thanks again for being so quick to help me out.
Update!
I added my credentials this way...
export AWS_ACCESS_KEY_ID=<key>
export AWS_SECRET_ACCESS_KEY=<secret>
...and everything worked perfectly!
I'm completely up and running. Hooray!
But if the project is supposed to load AWS credentials from the .env
file, something's fishy.
Thanks again!
Since the serverless support of accessing environment variables is still underdevelopment Issue:1455 we have used serverless-plugin-write-env-vars. This plugin allows to pass command-line parameters and set them as environment variables. The plugin uses dotenv library. We could skip the plugin and just use dotenv library. If we follow this approach we can define all our environment variables in .env file. eg:
DB_CONNECTION_STRING: <connection_string>
REMOTE_STAGE: <remote_stage>
...
The only drawback is we won't be able to pass down command-line options to set as environment variables. But on the plus side, we have the luxury of defining all the environment variables in one place and just use 'gulp deploy' to do the deployment. What do you all think of keeping a .env file and removing the plugin?
At the moment it is an overhead to include an environmental variable where you need to update serverless.yml and gulpfile(To support gulp deploy-api). Also when there are many environmental variables it makes it even problematic to append them as parameters. So I think its better to just use the dotenv library and .env file to support environmental variables for Lambda-NodeJS
@bhirsch42 Remember to add the following code as early as possible in your lambda code
require('dotenv').config();
I get the following error when running either
npm install
oryarn
on a fresh clone of the repository.And then these are the offending lines in the log:
Can anybody tell me what exactly is going wrong?