Comments (14)
@radelcom Oh that looks good. I'm going to try that out.
from serverless-nodejs-starter.
@radelcom Just updated the repo to use the babel source map plugin. Thanks for the feedback guys.
Closing this issue.
from serverless-nodejs-starter.
Compared against previous versions, it looks like the README.md should be updated to read
serverless webpack invoke --function hello
rather than
serverless invoke local --function hello -l
from serverless-nodejs-starter.
@luke-unifymonitor I'm not sure what is going on here but have you updated serverless-webpack
to v3 (https://github.com/serverless-heaven/serverless-webpack/releases/tag/v3.0.0)?
This is also why we are now using serverless invoke local
instead of serverless webpack invoke
.
from serverless-nodejs-starter.
Thanks @jayair. I haven't got serverless-webpack installed globally.
I just do a serverless install --url https://github.com/AnomalyInnovations/serverless-es7 --name my-project
The package.json it creates is as below which has "serverless-webpack": "^3.0.0"
in devDependencies.
{
"name": "my-test",
"version": "1.1.0",
"description": "A starter project for the Serverless Framework with ES7 support",
"main": "handler.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/AnomalyInnovations/serverless-es7.git"
},
"devDependencies": {
"babel-core": "^6.25.0",
"babel-loader": "^7.1.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-3": "^6.24.1",
"serverless-webpack": "^3.0.0",
"webpack": "^3.0.0",
"webpack-node-externals": "^1.6.0"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"source-map-support": "^0.4.14"
}
}
from serverless-nodejs-starter.
@luke-unifymonitor Yup that should work. You should now be able to run serverless invoke local --function hello
and it should run your function locally.
from serverless-nodejs-starter.
I am also getting similar error message with just sls deploy
and not specific function. I was digging around and narrowed it down. It seems like dependent on which ever node version I am using. I am using nvm as my node version manager. If I use node v6.10.3, I get this issue and if I switched to node v8.4.0, all goes away and deploys successfully.
I guess question is, is it ok to use node v8.4.0 development and wont have impact to the actual AWS supported node v6.10 version when serverless is deployed?
Any input is greatly appreciated. tx in advance!
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook before:deploy:createDeploymentArtifacts
Serverless: WARNING: Plugin ServerlessWebpack uses deprecated hook after:deploy:createDeploymentArtifacts
Syntax Error -------------------------------------------
Unexpected token ...
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
SyntaxError: Unexpected token ...
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:511:25)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:456:32)
at tryModuleLoad (module.js:415:12)
at Function.Module._load (module.js:407:3)
at Module.require (module.js:466:17)
at require (internal/module.js:20:19)
at ServerlessWebpack.validate
from serverless-nodejs-starter.
@jayair I'm afraid it doesn't work though - still getting the same error message.
Unexpected token ...
I'm on node 7.10.0
from serverless-nodejs-starter.
I'm also having this issue. I think it's this in webpack.config.js
:
...acc,
[key]: ["./_webpack/include.js", slsw.lib.entries[key]]
}), {});
Removing ...acc,
fixes this, but I'm getting unrelated errors to this issue. Just thought I'd add my 2 cents in case it helps.
from serverless-nodejs-starter.
@radelcom @luke-unifymonitor @jackmusick Thanks for all the details. Yeah I should switch the code around and not assume folks are running a higher version of Node. I'll push an update soon.
from serverless-nodejs-starter.
@radelcom @luke-unifymonitor @jackmusick Just pushed an update. Can you guys try again?
from serverless-nodejs-starter.
@jayair - That's sorted it for me. Thanks very much.
from serverless-nodejs-starter.
Great!
@radelcom @jackmusick If you guys can confirm, then we'll close the issue.
from serverless-nodejs-starter.
@jayair - looks good here now too. although I switched my implementation to use babel-plugin-source-map-support. Now I dont need the _webpack
folder with include.js
anymore.
my .babelrc
looks like this now
{
"plugins": ["source-map-support", "transform-runtime"],
"presets": ["es2015", "stage-3"]
}
and webpack.config.js
const slsw = require('serverless-webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: slsw.lib.entries,
target: 'node',
// Generate sourcemaps for proper error messages
devtool: 'source-map',
// Since 'aws-sdk' is not compatible with webpack,
// we exclude all node dependencies
externals: [nodeExternals()],
// Run babel on all .js files and skip those in node_modules
module: {
rules: [{
test: /\.js$/,
loaders: ['babel-loader', 'eslint-loader'],
include: __dirname,
exclude: /node_modules/
}]
}
};
from serverless-nodejs-starter.
Related Issues (20)
- Feature request: SAM template HOT 1
- Babel 7 support HOT 1
- Error message when installing dependencies HOT 5
- Any future updates to this repo - like updating to Node 10.x HOT 3
- Error: Can't resolve 'source-map-support/register' in 'libs/response-lib.js' HOT 17
- AWS_PROFILE=default serverless invoke local --function create --path mocks/create-event.json HOT 1
- Function Routes Defined in file not loaded HOT 2
- Clean install with deploy results in non-webpacked node functions HOT 1
- Debug lambda using VScode
- Tests do not load .env or serverless.yml variables HOT 8
- Can't create a project on Windows 10 - Request timed out HOT 1
- Cannot run sample project on aws lambda HOT 1
- Sharp module not found after deploy HOT 2
- Create Ticket - Instructor HOT 1
- Initial install throws serverless DeprecationWarning DEP0066
- Build crashes when using email-templates HOT 3
- Typescript version of the repo HOT 2
- gyp verb `which` failed Error: not found: python2 HOT 16
- As per Indian regulations, only registered Indian businesses (i.e. sole proprietorships, limited liability partnerships and companies, but not individuals) can accept international payments. More info here: https://stripe.com/docs/india-exports\" error.
- Serverless: Operation failed!
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 serverless-nodejs-starter.