GithubHelp home page GithubHelp logo

flowaccount / nx-plugins Goto Github PK

View Code? Open in Web Editor NEW
114.0 114.0 35.0 164.3 MB

Nx plugins built by FlowAccount team, helps deploy systems to the cloud

TypeScript 97.99% JavaScript 2.01%
angular angular-universal aws-lambda azure-functions google-cloud-function node-typescript nodejs nx-workspace schematics serverless serverless-framework

nx-plugins's People

Contributors

brian-weasner avatar codephobia avatar dependabot[bot] avatar etavener avatar golfwanlopt avatar hoang-innomize avatar lucalanca avatar milocosmopolitan avatar narongok avatar nbgitfa77 avatar nhammond101 avatar ookriangsakoo avatar squareli avatar tstackhouse avatar warrendugan avatar warrickhill avatar wickstargazer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nx-plugins's Issues

Nx build command freezes when adding @flowaccount/nx-serverless

First, thank you for putting this plugin together, it will be very useful to our team! We are currently putting together a minimal "todo list" nx app with the serverless/sls plugin and have very few, if any, changes to the codebase after the setting up the default nx templates.

Initial nx configuration:

yarn create nx-workspace todo-list-app
  ? What to create in the new workspace react-express     [a workspace with a full stack application (React + Express)]
  ? Application name                    todo-list-app
  ? Default stylesheet format           CSS 

yarn add -D @flowaccount/nx-serverless
nx generate @flowaccount/nx-serverless:application --name=sls-api --provider=aws --no-interactive

The following deploy command is successfully deploying the serverless app.

yarn nx run-many --target=deploy --all --parallel

However, the build command is failing. To build:

yarn nx run-many --target=build --all --parallel

The commands freezes after a while and does not continue (> 1 hour)

Starting type checking service...
Using 2 workers with 2048MB memory limit
 _______                             __
|   _   .-----.----.--.--.-----.----|  .-----.-----.-----.
|   |___|  -__|   _|  |  |  -__|   _|  |  -__|__ --|__ --|
|____   |_____|__|  \___/|_____|__| |__|_____|_____|_____|
|   |   |             The Serverless Application Framework
|       |                           serverless.com, v1.65.0
 -------'

Serverless {
  providers: {},
  version: '1.65.0',
  yamlParser: YamlParser { serverless: [Circular] },
  utils: Utils { serverless: [Circular] },
  service: Service {
    serverless: [Circular],
    service: 'sls-api',
    serviceObject: { name: 'sls-api' },
    provider: {
      stage: 'dev',
      variableSyntax: '\\${([ ~:a-zA-Z0-9._@\'",\\-\\/\\(\\)*?]+?)}',
      name: 'aws',
      runtime: 'nodejs10.x'
    },
    custom: undefined,
    plugins: [ 'serverless-offline' ],
    pluginsData: {},
    functions: { 'hello-world': [Object] },
    resources: undefined,
    package: {
      individually: true,
      path: undefined,
      artifact: undefined,
      exclude: undefined,
      include: undefined,
      excludeDevDependencies: false
    },
    serviceFilename: 'serverless.yml',
    app: undefined,
    tenant: undefined,
    org: undefined,
    layers: {},
    outputs: undefined
  },
  variables: Variables {
    serverless: [Circular],
    service: Service {
      serverless: [Circular],
      service: 'sls-api',
      serviceObject: [Object],
      provider: [Object],
      custom: undefined,
      plugins: [Array],
      pluginsData: {},
      functions: [Object],
      resources: undefined,
      package: [Object],
      serviceFilename: 'serverless.yml',
      app: undefined,
      tenant: undefined,
      org: undefined,
      layers: {},
      outputs: undefined
    },
    tracker: PromiseTracker {
      promiseList: [],
      promiseMap: {},
      startTime: 1583392410162,
      reported: false
    },
    deep: [],
    deepRefSyntax: /(\${)?deep:\d+(\.[^}]+)*()}?/,
    overwriteSyntax: /\s*(?:,\s*)+/g,
    fileRefSyntax: /^file\(([^?%*:|"<>]+?)\)/g,
    slsRefSyntax: /^sls:/g,
    envRefSyntax: /^env:/g,
    optRefSyntax: /^opt:/g,
    selfRefSyntax: /^self:/g,
    stringRefSyntax: /(?:('|").*?\1)/g,
    cfRefSyntax: /^(?:\${)?cf(\.[a-zA-Z0-9-]+)?:/g,
    s3RefSyntax: /^(?:\${)?s3:(.+?)\/(.+)$/,
    ssmRefSyntax: /^(?:\${)?ssm:([a-zA-Z0-9_.\-\/]+)[~]?(true|false|split)?/,
    strToBoolRefSyntax: /^(?:\${)?strToBool\(([a-zA-Z0-9_.\-\/]+)\)/,
    variableResolvers: [
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object], [Object],
      [Object]
    ]
  },
  pluginManager: PluginManager {
    serverless: [Circular],
    serverlessConfigFile: {
      service: 'sls-api',
      frameworkVersion: '>=1.1.0 <2.0.0',
      plugins: [Array],
      package: [Object],
      provider: [Object],
      functions: [Object]
    },
    cliOptions: {},
    cliCommands: [ 'build', 'sls-api' ],
    plugins: [],
    commands: {},
    aliases: {},
    hooks: {},
    deprecatedEvents: {}
  },
  cliInputArgv: [ 'build', 'sls-api' ],
  config: Config {
    serverless: [Circular],
    serverlessPath: '/home/aidan/Development/contract-work-v2/brits/nrwl-nx-fullstack-aws-refarch/nrwl-fullstack-aws/node_modules/@flowaccount/nx-serverless/node_modules/serverless/lib',
    config: 'apps/sls-api/serverless.yml',
    servicePath: 'apps/sls-api'
  },
  classes: {
    CLI: [Function: CLI],
    YamlParser: [Function: YamlParser],
    Utils: [Function: Utils],
    Service: [Function: Service],
    Variables: [Function: Variables],
    Error: [Function: ServerlessError],
    PluginManager: [Function: PluginManager]
  },
  serverlessDirPath: '/home/aidan/.serverless',
  isStandaloneExecutable: false,
  instanceId: '1583392410175',
  cli: CLI {
    serverless: [Circular],
    inputArray: [ 'build', 'sls-api' ],
    loadedPlugins: [],
    loadedCommands: {}
  },
  processedInput: { commands: [ 'build', 'sls-api' ], options: {} }
}
Serverless: getting all functions
Serverless: getting all functions
Serverless: start compiling webpack
Starting type checking service...
Using 2 workers with 2048MB memory limit
10% building 0/0 modules 0 activeHash: 7d8923a6e6645c010676
Built at: 03/05/2020 2:13:32 AM
Entrypoint main = main.js main.js.map
chunk {main} main.js, main.js.map (main) 57 bytes [entry] [rendered]
$ nx build api
10% building 0/1 modules 1 active ...k-aws-refarch/nrwl-fullstack-aws/apps/sls-api/src/handler.tsStarting type checking service...
Using 2 workers with 2048MB memory limit
98% after emitting SizeLimitsPluginNo type errors found
Version: typescript 3.7.5
Time: 5865ms
Hash: 8b4284d681286107239b
Built at: 03/05/2020 2:13:36 AM
Entrypoint src/handler = src/handler.js
chunk {src/handler} src/handler.js (src/handler) 412 bytes [entry] [rendered]
[./apps/sls-api/src/handler.ts] 370 bytes {src/handler} [built]
    factory:5811ms building:168ms = 5979ms
[tslib] external "tslib" 42 bytes {src/handler} [built]
    [./apps/sls-api/src/handler.ts] 5979ms -> factory:1ms building:1ms = 5981ms
Starting type checking service...
Using 2 workers with 2048MB memory limit
Hash: 620d5e1c46307a6df8b9
Built at: 03/05/2020 2:13:50 AM
Entrypoint main [big] = runtime.js runtime.js.map vendor.js vendor.js.map main.js main.js.map
Entrypoint polyfills [big] = runtime.js runtime.js.map polyfills.js polyfills.js.map
Entrypoint styles = runtime.js runtime.js.map styles.js styles.js.map
chunk {main} main.js, main.js.map (main) 796 bytes ={runtime}= ={vendor}= [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 239 KiB ={runtime}= [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 0 bytes ={main}= ={polyfills}= ={styles}= ={vendor}= [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 7.75 KiB ={runtime}= [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 1.04 MiB ={main}= ={runtime}= [initial] [rendered] split chunk (cache group: vendor) (name: vendor)
Hash: 50a49816d67d4698582c
Built at: 03/05/2020 2:13:51 AM
Entrypoint main = main.js main.js.map
chunk {main} main.js, main.js.map (main) 423 bytes [entry] [rendered]

Schematic app generation for native cloud platform

Is your feature request related to a problem? Please describe.

  • Schematic template generation for pulumi app

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[ ] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[] Lambda
[x] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Errors thrown on install even in blank repo

Describe the bug

Dependency resolution errors are thrown on install.

To Reproduce

mkdir test-nx-sls
cd test-nx-sls
npx create-nx-workspace test --preset=angular --nx-cloud=false --linter=eslint --style=css --appName=testapp
cd test
nx add @flowaccount/nx-serverless

Expected behavior

Package install should succeed on a fresh install.

Throws error

nx add @flowaccount/nx-serverless
? Would you like to share anonymous usage data about this project with the Angul
ar Team at
Google under Google’s Privacy Policy at https://policies.google.com/privacy? For
 more
details and how to change this setting, see http://angular.io/analytics. No
Installing packages for tooling via npm.
An unhandled exception occurred: npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated [email protected]: no longer supported
npm WARN deprecated [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated @types/[email protected]: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need @types/chalk installed!


┌─────────────────────────────────────────────────────────────┐
│                                                             │
│   The package prisma has been renamed to prisma1.           │
│                                                             │
│   Please uninstall prisma.                                  │
│   Then install prisma1 to continue using Prisma 1:          │
│                                                             │
│      # Uninstall old CLI                                    │
│      npm uninstall -g prisma                                │
│                                                             │
│      # Install new CLI                                      │
│      npm install -g prisma1                                 │
│                                                             │
│      # Invoke via global `prisma1` command                  │
│      prisma1 --help                                         │
│                                                             │
│   Learn more here:                                          │
│   https://github.com/prisma/prisma1/releases/tag/1.34.12    │
│                                                             │
│   Prisma 1 is in maintenance mode.                          │
│   We recommend to check out Prisma 2:                       │
│   http://pris.ly/d/upgrading-to-prisma2                     │
│                                                             │
└─────────────────────────────────────────────────────────────┘



npm WARN @angular-eslint/[email protected] requires a peer of eslint-plugin-import@* but none is installed. You must install peer dependencies yourself.
npm WARN @angular-eslint/[email protected] requires a peer of eslint-plugin-jsdoc@* but none is installed. You must install peer dependencies yourself.
npm WARN @angular-eslint/[email protected] requires a peer of eslint-plugin-prefer-arrow@* but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/[email protected] requires a peer of @angular/compiler-cli@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/[email protected] requires a peer of @angular/compiler-cli@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of tslint@^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-devkit/[email protected] requires a peer of ng-packagr@^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @nrwl/[email protected] requires a peer of @nrwl/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @nrwl/[email protected] requires a peer of @nrwl/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @nrwl/[email protected] requires a peer of @nrwl/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of tslint@^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@^2.1.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brianmcilwain/.npm/_logs/2021-01-25T15_44_26_873Z-debug.log
Package install failed, see above.
See "/private/var/folders/r8/5tt87lwn71z4679z4gkkt6880000gn/T/ng-sTE1NW/angular-errors.log" for further details.

Check which provider is affected:
[x] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[x] Angular
[x] Nodejs
[x] Serverless
[x] Lambda
[] Infrastructure as a code

All are affected as the package cannot currently be successfully installed due to now non-existent packages.

nx report 

>  NX  Report complete - copy this into the issue template

  Node : 14.15.4
  OS   : darwin x64
  npm  : 6.14.10
  
  nx : Not Found
  @nrwl/angular : 11.1.5
  @nrwl/cli : 11.1.5
  @nrwl/cypress : 11.1.5
  @nrwl/devkit : 11.1.5
  @nrwl/eslint-plugin-nx : 11.1.5
  @nrwl/express : Not Found
  @nrwl/jest : 11.1.5
  @nrwl/linter : 11.1.5
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 8.8.3
  @nrwl/react : Not Found
  @nrwl/schematics : 8.8.3
  @nrwl/tao : 11.1.5
  @nrwl/web : Not Found
  @nrwl/workspace : 11.1.5
  typescript : 4.0.5

Schematics generation for aws-cdk Lambda Nodejs

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

  • Schematic template for aws-cdk lambda

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[x] Nodejs
[] Serverless
[x] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Angular Delay plugin - when target is `es5`

Describe the bug
I've come across some issues with a project using this plugin.

The project has a tsconfig.json with a target that is es5.

It only added 1 script to the scripts to load (polyfills as this was the only one with es5 in the name).

I updated the target inside tsconfig.json from es5 to es2015 and now it works.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context about the problem here.

Create builders for aws-cdk app

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

  • synth runner for aws-cdk to generate cloud formation template
  • Deploy runner for aws-cdk
  • Destroy runner for aws-cdk

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[x] Lambda
[x] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[FEAT] pre-deploy scripts

Is your feature request related to a problem? Please describe.
Node/Typescript serverless lambda: So I have been playing around with your plugin (it's great!) and trying to use libraries in conjunction with a simple node lambda function that I am deploying to AWS.

My use case is that I want to use a library like bcrypt that webpack registers as an external, meaning the dependency is gathered as a part of your deploy script, not build.

So running nx build my-lib will only generate a single JavaScript file in dist, but running nx deploy my-lib will pull in the externals inside dist/my-lib/node_modules.

This all sounds great until one of these externals requires building with something like node-pre-gyp before deployment to AWS. Right now there is no way of say... going in to dist/my-lib/node_modules/bcrypt and running the build command to generate the .node binary necessary for the lambda to actually run.

Describe the solution you'd like
An optional property adding to the builder to specify pre-deploy scripts that happen after webpack is done compiling the bundle.

Check which provider is affected:
[*] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[*] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

[BUG] scully-plugin-angular-delay

Describe the bug
When I add your plugin to my static site there seems to be a bug.

I get the following console error:
Uncaught TypeError: scriptsToLoad.forEach is not a function

The scripts are not loaded at all.

On further investigation, when I look at the code added to my HTML page I see this:

window.addEventListener('load', function(event) {
        setTimeout( function() {
          scriptsToLoad.forEach(entry => {
            appendScript(entry);
          });
        }, 1500);
      });
    scriptsToLoad = '["runtime-es5.js","polyfills-es5.js","polyfills-es2015.js","vendor-es5.js","runtime-es2015.js","vendor-es2015.js","main-es2015.js","main-es5.js","styles-es2015.js","styles-es5.js"]'

So I can see the issue is a forEach on a string when an array is expected.

I think this can be easily fixed by having this line instead (I removed the single quotes wrapping the ${}:

appendScript += `scriptsToLoad = ${JSON.stringify(sorted)}`;

I've also made this change in this PR:
#33

If this is incorrect, please let me know what the solution is.

Versions
@flowaccount/[email protected]
@scullyio/[email protected]
@scullyio/[email protected]
@scullyio/[email protected]

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

[BUG] serverless deploy fail through the nx plugin

Issue
During the deployment the serverless plugin stops at packaging the service

To Reproduce
Steps to reproduce the behavior:

  1. Configure your AWS ID and secret
  2. generate a serverless app with the cli nx g @flowaccount/serverless:app ...
  3. execute deploy target: nx deploy myapp

Expected behavior
The CLI should pass the packaging step, it simply stops with no error.

Screenshots
If applicable, add screenshots to help explain your problem.

Check which provider is affected:
[X] AWS

Check which framework is affected:
[x] Serverless

Additional context
The generated app requires sls below 2.0, current version is 2.6.0
The tsconfig file extended is looking at the wrong path '../../tsconfig.json' instead of '../../tsconfig.base.json'

OS: Linux 5.4.0-48-generic x86_64
Distribution: Linux Mint

Might be related to
#50

Add schematics template files for GCP

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[] AWS
[] Azure
[x] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

Create builders for native cloud platform

Is your feature request related to a problem? Please describe.

  • Build runner for pulumi
  • Deploy runner for pulumi
  • Destroy runner for pulumi

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[ ] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] nx add throws error `Could not find project "@flowaccount/nx-serverless"`

Describe the bug

nx add throws could not find project error

To Reproduce
Steps to reproduce the behavior:

mkdir nx-sls
cd nx-sls
npx create-nx-workspace test --preset=empty --nx-cloud=false # Same with create-nx-workspace@latest
cd test
nx add @flowaccount/nx-serverless

Returns error Could not find project "@flowaccount/nx-serverless"

Expected behavior

The given instructions for installing the plugin should not produce an error

Check which provider is affected:
[x] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[x] Angular
[x] Nodejs
[x] Serverless
[x] Lambda
[x] Infrastructure as a code

Affects everything - can't add to a project

nx --version
11.1.5

[BUG] - Update readme.md to be correct

Describe the bug
In the Readme the command to NPM install should be updated to:
npm install @flowaccount/scully-plugin-angular-delay --save-dev

Check which provider is affected:

Check which framework is affected:
[X] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context

[FEAT] nx-serverless - add ability to exclude modules from generated package.json

I'd like to be able to exclude modules from the serverless deploy package. I have layers setup that include a lot of modules that I use across multiple functions.

I'd like to be able to specify excluded modules in the build options. There is a forceExcludes parameter passed to getProdModules that is always passed in as an empty array [].

In addition forceExcludes is only used to avoid throwing an error if a runtime dependency is in devDependencies.

!_.includes(forceExcludes, module.external)

I propose that we add forceExcludes to build options and not add those modules to the created package.json.

Check which provider is affected:
[X] AWS
[X] Azure
[X] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[X] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
I've tested deploys w/ the modules that I have in my layer removed from the package.json and it works as expected. Doing this takes my individual function bundle sizes down from 12.8mb each to a few kb.

[FEAT] Ability to pass in the path of tsconfig.json for scully-plugin-angular-delay

Is your feature request related to a problem? Please describe.
Currently when using scully-plugin-angular-delay with an app that is in a yarn monorepo, the tsconfig.json lives outside of the package folder (scully root path). This throws an error as we do not have any way to pass in the correct path of the file.

Describe the solution you'd like
Ability to pass in the path for the tsconfig.json file.

Describe alternatives you've considered
Looking at the source code, this seems like it would be the best solution.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
I'd be willing to put together a PR for this, but this could be a pretty big breaking change.

[FEAT] aws-cdk support

Is your feature request related to a problem? Please describe.
I've been working a bit on setting up an aws-cdk builder so I can also manage my infrastructure as code via NX.

Describe the solution you'd like
I've now found you nx-aws-cdk builder and schema and would like to avoid double work. What's the status? Do you plan on publishing to npm any time soon?

Describe alternatives you've considered
Any way I can help? Otherwise I would most likely work on this on my own, and maybe get some inspiration from your work so far.

Check which provider is affected:
[X] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[] Lambda
[X] Infrastructure as a code

[BUG?] Possible problems with plugins that use require()

Describe the bug
I am trying to use nx-serverless with serverless-stack-output plugin and it always fails if I set handler function

To Reproduce
Steps to reproduce the behavior:

  1. Add serverless-stack-output plugin in serverless.yml. It does not matter if it is original package or one of latets forks like @anttiviljami/serverless-stack-output
  2. Add custom typescript or javascript handler function.
  3. Add custom>output>handler path to function
  4. Run nx deploy app
  5. See error : Cannot process Stack Output: Cannot find module "path to module"

If sls deploy command is executed from dist folder everything is fine. Maybe problem is related to setting servicePath or problem is in serverless cli.

Expected behavior
The same result as executing sls deploy

Screenshots

Check which provider is affected:
[X] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[X] Serverless
[] Lambda
[] Infrastructure as a code

Additional context

New Project Not Working

Steps taken:

  • yarn create nx-workspace
  • choose angular-nest
  • nx add @flowaccount/nx-serverless --project=api

Error:

An unhandled exception occurred: warning @flowaccount/nx-serverless > @nrwl/schematics > [email protected]: no longer supported
warning @flowaccount/nx-serverless > @angular-devkit/build-angular > webpack-dev-server > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning @flowaccount/nx-serverless > fork-ts-checker-webpack-plugin > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning @flowaccount/nx-serverless > @angular-devkit/build-angular > less > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @flowaccount/nx-serverless > serverless > @serverless/components > @serverless/platform-client > [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
warning @flowaccount/nx-serverless > @angular-devkit/build-angular > istanbul-instrumenter-loader > istanbul-lib-instrument > babel-generator > babel-runtime > [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
warning @flowaccount/nx-serverless > serverless > @serverless/components > @serverless/platform-client-china > @serverless/utils-china > @tencent-sdk/capi > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @flowaccount/nx-serverless > serverless > @serverless/components > @serverless/platform-client-china > @serverless/utils-china > @tencent-sdk/capi > @types/[email protected]: This is a stub types definition for chalk (https://github.com/chalk/chalk). chalk provides its own type definitions, so you don't need @types/chalk installed!
warning "@nrwl/angular > @nrwl/cypress > @cypress/[email protected]" has unmet peer dependency "webpack@^4.18.1".
warning "@nrwl/angular > @nrwl/cypress > @cypress/webpack-preprocessor > [email protected]" has unmet peer dependency "webpack@>=2".
warning " > @angular-eslint/[email protected]" has unmet peer dependency "eslint-plugin-import@*".
warning " > @angular-eslint/[email protected]" has unmet peer dependency "eslint-plugin-jsdoc@*".
warning " > @angular-eslint/[email protected]" has unmet peer dependency "eslint-plugin-prefer-arrow@*".
warning "@flowaccount/nx-serverless > @ngtools/[email protected]" has incorrect peer dependency "@angular/compiler-cli@^8.0.0".
warning "@flowaccount/nx-serverless > @ngtools/[email protected]" has incorrect peer dependency "typescript@>=3.4 < 3.6".
warning "@flowaccount/nx-serverless > @angular-devkit/[email protected]" has incorrect peer dependency "@angular/compiler-cli@^8.0.0".
warning "@flowaccount/nx-serverless > @angular-devkit/[email protected]" has incorrect peer dependency "typescript@>=3.1 < 3.6".
warning "@flowaccount/nx-serverless > @angular-devkit/[email protected]" has unmet peer dependency "ng-packagr@^4.0.0 || ^5.0.0".
warning "@flowaccount/nx-serverless > [email protected]" has unmet peer dependency "webpack-sources@>=1.0.0".
warning "@flowaccount/nx-serverless > [email protected]" has unmet peer dependency "tslint@^4.0.0 || ^5.0.0".
warning "@flowaccount/nx-serverless > [email protected]" has incorrect peer dependency "typescript@^2.1.0 || ^3.0.0".
warning "@flowaccount/nx-serverless > serverless > @serverless/components > [email protected]" has unmet peer dependency "inquirer@^5.0.0 || ^6.0.0 || ^7.0.0".
error An unexpected error occurred: "could not find a copy of webpack to link in /Users/warren/nest-sls/node_modules/@flowaccount/nx-serverless/node_modules/@nrwl/node/node_modules".
Package install failed, see above.
See "/private/var/folders/24/99d60md53xv0z299d0__p1580000gn/T/ng-sCfoGW/angular-errors.log" for further details.

[BUG] package.custom not supported in serverless.yml

Describe the bug
In the default serverless.yml generated by nx-serverless, it includes the custom key under the package property. In recent versions of serverless, this fails schema validation, as seen in the following output:

Serverless: Configuration warning at 'package': unrecognized property 'custom'
Serverless:  
Serverless: If you prefer to not continue ensure "configValidationMode: error" in your config
Serverless: If errors are influenced by an external plugin, enquiry at plugin repository so schema extensions are added (https://www.serverless.com/framework/docs/providers/aws/guide/plugins#extending-validation-schema)
Serverless: If errors seem invalid, please report at https://github.com/serverless/serverless/issues/new?template=bug_report.md
Serverless: If you find this functionality problematic, you may turn it off with "configValidationMode: off" setting

To Reproduce
Generate an nx-serverless project using a recent release of serverless (I have observed this in 1.79.0, but this likely also includes other versions > 1.58.0, I don't have the time to bisect my way to the first version, but I wanted to log the issue)

Run serverless and observe the validation warning.

Expected behavior
No warning is thrown by serverless

Screenshots

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
The generated configuration can be seen originating in these files:
https://github.com/flowaccount/nx-plugins/search?q=enable_optimize&unscoped_q=enable_optimize

Add angular universal schematic template to serverless app.

Is your feature request related to a problem? Please describe.

  • Add supprot for aws-serverless-express
  • Add severless.yml template for this project type
  • Add universal server.ts template for angular universal
  • Add test to make sure schema.json is correct
  • Edit Docs/Readme for release

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[X] AWS
[ ] Azure
[ ] Google Cloud Platform

Check which framework is affected:
[X] Angular
[ ] Nodejs
[X] Serverless
[ ] Lambda
[ ] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

An unhandled exception occurred: Cannot read property 'cli' of undefined

https://github.com/flowaccount/nx-plugins/blob/df7b74f4728ed356f6c8cc81150ded3c19234bd2/libs/nx-serverless/src/utils/normalize.ts#

Running nx serve <app-name> or nx build <app-name>

throws a TypeError:

Serverless: getting all functions
An unhandled exception occurred: Cannot read property 'cli' of undefined

Log:

[error] TypeError: Cannot read property 'cli' of undefined
    at getEntryExtension (<projectroot>/libs/nx-serverless/src/utils/normalize.ts:166:21)
    at Object.exports.getEntryForFunction (<projectroot>/libs/nx-serverless/src/utils/normalize.ts:115:15)
    at <projectroot>/libs/nx-serverless/src/utils/normalize.ts:25:19
    at arrayEach (<projectroot>/node_modules/lodash/lodash.js:516:11)
    at Function.forEach (<projectroot>/node_modules/lodash/lodash.js:9342:14)
    at Object.assignEntriesToFunctionsFromServerless (<projectroot>/libs/nx-serverless/src/utils/normalize.ts:23:5)
    at MapSubscriber.project (<projectroot>/libs/nx-serverless/src/builders/build/build.impl.ts:38:14)
    at MapSubscriber._next (<projectroot>/node_modules/rxjs/src/internal/operators/map.ts:84:29)
    at MapSubscriber.Subscriber.next (<projectroot>/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
    at SwitchMapSubscriber.notifyNext (<projectroot>/node_modules/rxjs/src/internal/operators/switchMap.ts:172:24)
    at InnerSubscriber._next (<projectroot>/node_modules/rxjs/src/internal/InnerSubscriber.ts:17:17)
    at InnerSubscriber.Subscriber.next (<projectroot>/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
    at CombineLatestSubscriber.notifyNext (<projectroot>/node_modules/rxjs/src/internal/observable/combineLatest.ts:313:26)
    at InnerSubscriber._next (<projectroot>/node_modules/rxjs/src/internal/InnerSubscriber.ts:17:17)
    at InnerSubscriber.Subscriber.next (<projectroot>/node_modules/rxjs/src/internal/Subscriber.ts:99:12)
    at MergeMapSubscriber.notifyNext (<projectroot>/node_modules/rxjs/src/internal/operators/mergeMap.ts:168:22)

[DOCS] Including custom webpack config with nx-serverless

Is your feature request related to a problem? Please describe.
It looks like nx-serverless already supports custom webpack configs (According to this), unfortunately there is no documentation on how to use them.

Describe the solution you'd like
Addition to docs on how to include my own webpack.config.js.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

[FEAT] Circle CI setup for the repository

Is your feature request related to a problem? Please describe.
Make repository work with circle ci and git action for continous integration.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] nx-serverless addUniversal option

Describe the bug
The current docs for the nx-serverless schematic are wrong at the addUniversal option. It does accept a boolean instead of yes as stated.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new nx-workspace
  2. Run nx add @flowaccount/nx-serverless with the --addUniversal=yes option as stated on the docs.
  3. See error
Cannot parse arguments. See below for the reasons.
    Argument --addUniversal could not be parsed using value "yes".Valid type(s) is: boolean

Expected behavior
No error should show up. The documentation need small changes to reflect the correct value.

Screenshots

image

Check which provider is affected:

  • AWS
  • [] Azure
  • [] Google Cloud Platform

Check which framework is affected:

  • Angular
  • [] Nodejs
  • [] Serverless
  • [] Lambda
  • [] Infrastructure as a code

Additional context
Running on Windows 10 using git bash.

[BUG]Stage option passed to SLS build doesn't make it to serverless.yml config.

Describe the bug
When I run nx run <project>:sls --configuration deploy-production the STAGE key still has a value of dev

To Reproduce
https://github.com/warrendugan/nx-sls

Expected behavior
When using deploy-production vs. deploy-dev, I expect the stage option to be passed to the serverless configuration so it deploys to the correct environemnt. Currently I get the same outcome (see screenshot) regardless of which command is used.

Screenshots
image

Check which provider is affected:
[x] AWS

Check which framework is affected:
[x] Angular
[x] Nodejs
[x] Serverless
[x] Lambda

[FEAT] Support serverless-appsync-offline

Is your feature request related to a problem? Please describe.
Currently it looks like the serverless command being run is just offline however it would be nice if to have an option to run appsync-offline start as part of the serverless-appsync-offline plugin

Describe the solution you'd like
Either determining the proper offline command to run by looking at the plugins in the serverless.yml or perhaps another builder for using serverless-appsync-offline

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

[BUG] scully-plugin-google-analytics not installing

Describe the bug
Angular 10
When installing with npm the package doesn't get to the filesystem. I should see the plus with the package name no?

To Reproduce

sburke@sburke-xps:~/sandbox/gdeonline/frontend$ npm un @flowaccount/scully-plugin-google-analytics --save-dev
npm WARN @scullyio/[email protected] requires a peer of @angular/common@^9.0.0-rc.6 but none is installed. You must install peer dependencies yourself.
npm WARN @scullyio/[email protected] requires a peer of @angular/core@^9.0.0-rc.6 but none is installed. You must install peer dependencies yourself.
npm WARN @scullyio/[email protected] requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@~3.7.5 || ~3.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 5.285s

59 packages are looking for funding
  run `npm fund` for details

sburke@sburke-xps:~/sandbox/gdeonline/frontend$ npm i @flowaccount/scully-plugin-google-analytics --save-dev
npm WARN @scullyio/[email protected] requires a peer of @angular/common@^9.0.0-rc.6 but none is installed. You must install peer dependencies yourself.
npm WARN @scullyio/[email protected] requires a peer of @angular/core@^9.0.0-rc.6 but none is installed. You must install peer dependencies yourself.
npm WARN @scullyio/[email protected] requires a peer of tslib@^1.10.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of popper.js@^1.16.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/compiler@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @angular/core@>=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of typescript@~3.7.5 || ~3.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN @flowaccount/[email protected] requires a peer of @scullyio/scully@^0.0.91 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

up to date in 7.242s

59 packages are looking for funding
  run `npm fund` for details

Expected behavior
Package should be installed.

Screenshots
If applicable, add screenshots to help explain your problem.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[X] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context about the problem here.

[FEAT] Example application to be added to this repository itself!

Is your feature request related to a problem? Please describe.
Add example applications for multiple clouds to the repository for guide and useful documentaitons

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[x] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[x] Angular
[x] Nodejs
[x] Serverless
[x] Lambda
[x] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] file replacement not working

file relacement section in angular.json wasn't working when use this builder.

"fileReplacements": [{
"replace": "apps/cdk/environments/environment.ts",
"with": "apps/cdk/environments/environment.staging.ts"
}]

I try with serverless project and cdk project It's not really replace for sure

[BUG]

How do I pass in a stage when trying to deploy? I am running nx deploy sls-cognito-triggers --stage=staging but every time it deploys, it deploys to dev.

[BUG] scully-plugin-angular-delay - Angular 10

Describe the bug
I upgraded my Angular 9 app to Angular 10.

After doing a build with ng build --prod --stats-json

I got this error (this error didn't appear before):

Error: A stats-es2015.json is required for the 'delayAngular' plugin.
Please run 'ng build' with the '--stats-json' flag

I checked my dist folder and there was a stats.json file not a stats-es2015.json. I renamed the file to stats-es2015.json and the error disappeared.

I think you should just check for both files and use the one that exists and if neither exists show the error.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context about the problem here.

[BUG] Can't include a yml function file.

Describe the bug
Can't include a yml function file.

To Reproduce
I move below code to hello-world.yml
`
hello-world:

handler: src/functions/hello-world/hello-world.handler

events:

  - http:

      path: hello-world

      method: get

`
And update serverless.yml
hello-world: '${file(/src/functions/hello-world/hello-world.yml)}'

Expected behavior
serverless.yml will include code of hello-world.yml

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Schematics generation for aws-cdk app type

Is your feature request related to a problem? Please describe.

  • Schematic template generation for aws-cdk app

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[] Serverless
[] Lambda
[x] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Incorrect AWS region value but default value is source-map-support/register

I tried to use the serverless offline to run the application on local and invoke some AWS Services but It's always got timeout because of the serverless always got region is source-map-support/register.

Check which provider is affected:
[x] AWS

Check which framework is affected:
[x] Nodejs
[x] Serverless

Additional context
I am not sure why we need provide the default the argument in offline.impl as:
const args = ['-r', 'source-map-support/register'];

Please not that serverless also use option "-r" to provide the region on application refer to https://www.serverless.com/framework/docs/providers/aws/cli-reference/deploy/
--region or -r The region in that stage that you want to deploy to.

[BUG] Debug output from serverless (sls) is not provided

Describe the bug
When using the nx run-many --targets=deploy --all command, deployments can fail silently. The failures are usually correct, eg. bad underlying serverless.yml file, but there is no way to debug the failure without the log output from serverless.

To Reproduce

yarn create nx-workspace todo-list-app
  ? What to create in the new workspace react-express     [a workspace with a full stack application (React + Express)]
  ? Application name                    todo-list-app
  ? Default stylesheet format           CSS 

yarn add -D @flowaccount/nx-serverless
nx generate @flowaccount/nx-serverless:application --name=sls-api --provider=aws --no-interactive

Add an error to the serverless.yml file, like this badly indented "vpc" parameter:

functions:
  # https://serverless.com/framework/docs/providers/aws/guide/variables/#referencing-environment-variables
  hello-world:
    handler: src/handler.helloWorld
    events:
      - http:
          path: hello-world
          method: get
  vpc:
     subnetIds:
        - 'Hello, nice to meet you, I am an error'

Expected behavior

Screenshots
If applicable, add screenshots to help explain your problem.

Check which provider is affected:
[x] AWS
[probably] Azure
[probably] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Linux

Set the SLS_DEBUG flag:

export SLS_DEBUG=true

The silent failure of nx deploy --target=deploy

Serverless: Load command param:get
Serverless: Load command param:list
Hash: dcbfaafc7f35681865e0
Built at: 03/15/2020 3:43:52 PM
Entrypoint src/handler = src/handler.js
chunk    {0} src/handler.js (src/handler) 412 bytes [entry] [rendered]
[0] external "tslib" 42 bytes {0} [built]
    [1] 1617ms -> factory:3ms building:1ms = 1621ms
[1] ./apps/sls-api-v2/src/handler.ts 370 bytes {0} [built]
    factory:1278ms building:339ms = 1617ms
Serverless: getting external modules
Serverless: create a package.json with first level dependencies
Serverless: generate lock entry for yarn for dependency graph to work.
Serverless: get the packagelist with dependency graph and depth=2 level
Serverless: re-writing package.json with dependency-graphs
Serverless: WARNING: Could not determine version of module tslib
Serverless: run packager to  install node_modules
Serverless: yarn install v1.21.1
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 0.55s.

Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...


———————————————————————————————————————————————


>  NX   ERROR  Running target "deploy" failed

  Failed projects:
  
  - sls-api-v2
  
  You can isolate the above projects by passing: --only-failed

The native output with helpful output of serverless: serverless deploy. In this case, "vpc" is being interpreted as a separate lambda function rather than a parameter of hello-world

Serverless: Load command param:get
Serverless: Load command param:list
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Packaging service...
 
  Serverless Error ---------------------------------------
 
  ServerlessError: Missing "handler" property in function "vpc". Please make sure you point to the correct lambda handler. For example: handler.hello. Please check the docs for more info

Support newer Serverless framework

Describe the bug
Is there a way to use the newer version of serverless? for example, 2.29.0.
I tried npm install serverless@latest after installing this plugin, then change the frameworkVersion in the yml file to >2.1.0. But this plugin seems to still use an older version - 1.83.2:
The Serverless version (1.83.2) does not satisfy the "frameworkVersion" (>=2.1.0) in serverless.yml

Check which provider is affected:
[x] AWS

Check which framework is affected:
[x] Serverless

Make destroy command work

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

  • Add destroy command for serverless
  • update readme/docs for release
    Describe alternatives you've considered
    A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[x] AWS
[x] Azure
[x] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

[BUG] Reference to tsconfig.json broken; renamed to tsconfig.base.json

Describe the bug
Generated serverless project refers to non-existent tsconfig.json. It appears a recent commit renamed the file to tsconfig.base.json.

To Reproduce
Steps to reproduce the behavior:

  1. Obtain an nx workspace
  2. Add a serverless framework project – npx nx g @flowaccount/nx-serverless:api-serverless --name=bug-repro --provider=aws --directory=
  3. Add a plain TypeScript lib to the workspace – npx yarn add @nrwl/node && npx nx g @nrwl/node:library "@someorg/constants"
  4. Open handler.ts from the serverless project created prior and add the statement import {foo} from '@someorg/constants';
  5. The IDE will complain about the import because it cannot locate the lib

Expected behavior
The IDE should find the lib. The tsconfig in the serverless project should contain a valid reference to the root tsconfig.

Check which provider is affected:
[x] AWS
[] Azure (not tested, but likely)
[] Google Cloud Platform (not tested, but likely)

Check which framework is affected:
[] Angular (not tested)
[] Nodejs (not tested)
[x] Serverless
[] Lambda (not tested)
[] Infrastructure as a code (not tested)

Additional context
This commit in the nx project seems to be the culprit.

As a workaround, I created a tsconfig.json that extends tsconfig.base.json.

[FEAT] Update offline schema to not fail on unused arguments (such as watch)

Is your feature request related to a problem? Please describe.
When attempting to create an e2e project to test an api built with nx-serverless:offline, it fails with a schema validation error because the watch option is passed by the cypress builder, but it is not part of the schema for serverless:offline and additionalProperties is set to false.

Describe the solution you'd like
To the schema for nx-serverlss:offline, either watch is added as e.g. an enum boolean that is always true or additionalProperties is set to true so that unused arguments are simply ignored rather than causing a hard fail.

Describe alternatives you've considered
The only real alternative would be to run 2 separate processes, starting the api manually, then having a cypress instance configured to not run a builder at all.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
I made this exact change in my node_modules and everything ran as expected.

[BUG] Angular Delay Plugin - Do you have this working at all? Please share the tsconfig.json

Describe the bug
Hi, I seem to be finding a lot of issues with this library and I'm wondering if it has ever worked.

My angular scripts now load after the delay but no code is executed. For example, I put a console log on a component and it never happens. I also have a form that doesn't work. No Angular code is executed after you load the scripts.

I was wondering if you have this working, please can you share how you use it. I may have changed something in my tsconfig to create this issue, although it works without this plugin.

Check which provider is affected:
[] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context about the problem here.

[BUG] Not able to run or build the freshly scaffolded project

Describe the bug
I am not able to run or build the freshly scaffolded project. It is showing an error and exits the process as in the screenshot.

To Reproduce
Steps to reproduce the behavior:

  1. create a workspace npx create-nx-workspace with next.js as an initial app
  2. install (npm install -D @flowaccount/nx-serverless) and int (nx g @flowaccount/nx-serverless:init) the plugin
  3. Try running (nx serve lambda-test --port=7777) or building (nx build lambda-test) the app

Expected behavior
Should be able to build the app or serve it locally

Screenshots
image

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[x] Nodejs
[x] Serverless
[x] Lambda
[] Infrastructure as a code

Additional context

NX  Report complete - copy this into the issue template

  Node : 12.18.4
  OS   : linux x64
  npm  : 6.14.6
  
  nx : Not Found
  @nrwl/angular : Not Found
  @nrwl/cli : 12.2.0
  @nrwl/cypress : 12.2.0
  @nrwl/devkit : 12.2.0
  @nrwl/eslint-plugin-nx : 12.2.0
  @nrwl/express : 9.2.2
  @nrwl/jest : 12.2.0
  @nrwl/linter : 12.2.0
  @nrwl/nest : Not Found
  @nrwl/next : 12.2.0
  @nrwl/node : 9.2.2
  @nrwl/react : 12.2.0
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.2.0
  @nrwl/web : 12.2.0
  @nrwl/workspace : 12.2.0
  @nrwl/storybook : 12.2.0
  @nrwl/gatsby : Not Found
  typescript : 4.1.5

package.json

{
  "name": "test-lambda",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "nx": "nx",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test",
    "lint": "nx workspace-lint && nx lint",
    "e2e": "nx e2e",
    "affected:apps": "nx affected:apps",
    "affected:libs": "nx affected:libs",
    "affected:build": "nx affected:build",
    "affected:e2e": "nx affected:e2e",
    "affected:test": "nx affected:test",
    "affected:lint": "nx affected:lint",
    "affected:dep-graph": "nx affected:dep-graph",
    "affected": "nx affected",
    "format": "nx format:write",
    "format:write": "nx format:write",
    "format:check": "nx format:check",
    "update": "nx migrate latest",
    "workspace-generator": "nx workspace-generator",
    "dep-graph": "nx dep-graph",
    "help": "nx help"
  },
  "private": true,
  "dependencies": {
    "core-js": "^3.6.5",
    "document-register-element": "1.13.1",
    "next": "10.2.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "regenerator-runtime": "0.13.7",
    "tslib": "^2.0.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1102.0",
    "@babel/core": "7.12.13",
    "@babel/preset-env": "7.12.13",
    "@babel/preset-react": "7.12.13",
    "@babel/preset-typescript": "7.12.13",
    "@flowaccount/nx-serverless": "^0.5.3",
    "@nrwl/cli": "12.2.0",
    "@nrwl/cypress": "12.2.0",
    "@nrwl/eslint-plugin-nx": "12.2.0",
    "@nrwl/jest": "12.2.0",
    "@nrwl/linter": "12.2.0",
    "@nrwl/next": "12.2.0",
    "@nrwl/react": "12.2.0",
    "@nrwl/tao": "12.2.0",
    "@nrwl/web": "12.2.0",
    "@nrwl/workspace": "12.2.0",
    "@testing-library/react": "11.2.6",
    "@types/aws-lambda": "^8.10.40",
    "@types/jest": "26.0.8",
    "@types/node": "14.14.33",
    "@types/react": "17.0.3",
    "@types/react-dom": "17.0.3",
    "@typescript-eslint/eslint-plugin": "4.19.0",
    "@typescript-eslint/parser": "4.19.0",
    "babel-jest": "26.2.2",
    "cypress": "^6.0.1",
    "dotenv": "8.2.0",
    "eslint": "7.22.0",
    "eslint-config-prettier": "8.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-import": "2.22.1",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-react": "7.23.1",
    "eslint-plugin-react-hooks": "4.2.0",
    "jest": "26.2.2",
    "node-sass": "5.0.0",
    "prettier": "2.2.1",
    "serverless": "1.58.0",
    "serverless-offline": "^5.12.0",
    "ts-jest": "26.5.5",
    "ts-node": "~9.1.1",
    "tslint": "~6.1.0",
    "typescript": "~4.1.4"
  }
}

[FEAT] Aws-cdk api gateway binary to support web applications

Is your feature request related to a problem? Please describe.
Need to implement cdk to create api gateway binary / for html/web universal apps.

Describe the solution you'd like

Describe alternatives you've considered

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[x] Angular
[] Nodejs
[] Serverless
[x] Lambda
[x] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

Support latest nx version

Is your feature request related to a problem? Please describe.
Atm the plugin has nx "^9.2.2" as a peer dep. Latest nx version is 11

Describe the solution you'd like
Upgrade to latest version

[BUG] npx nx deploy fails

Describe the bug
The command npx nx deploy fails.

I dont have yarn installed on my computer, what do i need to do to use npm?

"@flowaccount/nx-serverless": "^0.5.2",

Expected behavior
Want to be able to deploy my web application

Screenshots
image

Check which provider is affected:
[X] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[X] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Using windows 10 and npm as a package manager

[FEAT] Build functions individually

Describe the solution you'd like
Serverless supports the package.individually flag, however during the build step, all functions are passed through webpack together, resulting in a single dist build that the packaging step then pulls from. Without adding separate include/exclude rules to each function, this results in deployment artifacts that are identical (and can cause memory exhaustion in the packaging step as each artifact is built in complete parallel). Adding a global exclude and including individual function handlers to each artifact helps with this, however the generated node_modules includes deps for all the functions, not just the one that is pulled in.

Describe alternatives you've considered

  • Not using package.individually results in each lambda having the same artifact deployed
  • Using the flag will create artifacts for each lambda, but they are wtill identical
  • Adding individual include declarations will pull only the compiled handler, but node_modules is still identical
  • Refactoring to make smaller apps is also a possibility, but that would still face the same kinds of shortcomings of packaging individually.

Check which provider is affected:
[X] AWS
[?] Azure
[?] Google Cloud Platform

Check which framework is affected:
[] Angular
[x] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
I'm working on a project that we're using nx-serverless in production, and currently have ~60 lambda handlers in our API.

[BUG] Serverless exclude sections are not working as expected

Describe the bug

service: hello-world
frameworkVersion: ">=1.1.0 <2.0.0"
plugins:
  - serverless-offline
package:
  individually: true
  excludeDevDependencies: true
  exclude:
    - src/**
  include:
    - src/function/handler.js
  custom:
    enable_optimize:
      local: false
provider:
  name: aws
  runtime: nodejs12.x
  stage: ${opt:stage, 'dev'}
functions:
  config:
    handler: src/handler.hello

the exclude is not getting excluded

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Check which provider is affected:
[x] AWS
[] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context about the problem here.

[FEAT] I need to add more options when running serve command

Currently, with the current build target, there is no option available so that I can add more options when running serverless offline. For example, I use serverless-offline-local-authorizers-plugin to run the custom authorizer locally, I need to add a custom option after sls offline command i.e. sls offline local-authorizers --stage dev --region eu-central-1

I think we could add an option i.e. args likes NX run-command builder so that we can add more options without updating our builder schema.

[BUG] Could not check for peer dependencies of x package

I am getting below warning when deploying our service

getting external modules
create a package.json with first level dependencies
Serverless: WARNING: Could not check for peer dependencies of serverless-mysql
generate lock entry for yarn for dependency graph to work.
get the packagelist with dependency graph and depth=2 level
re-writing package.json with dependency-graphs
Serverless: WARNING: Could not determine version of module tslib
Serverless: WARNING: Could not check for peer dependencies of serverless-mysql
run packager to  install node_modules

Here is the sample code of my Lambda function

// Require and initialize outside of your main handler
import * as serverlessMysql from 'serverless-mysql';
const mysql = serverlessMysql({
  config: {
    host     : process.env.ENDPOINT,
    database : process.env.DATABASE,
    user     : process.env.USERNAME,
    password : process.env.PASSWORD
  }
})

// Main handler function
export const handler = async (event, context) => {
  // Run your query
  let results = await mysql.query('SELECT * FROM table')

  // Run clean up function
  await mysql.end()

  // Return the results
  return results
}

I have debugged and figured out that the modulePackagePath is invalid (the root dir is duplicated in the path), see below example

modulePackagePath /Users/hoangle/Documents/Working/Source/my-sls-api/Users/hoangle/Documents/Working/Source/my-sls-api/node_modules/serverless-mysql/package.json

Add schematics template files for Azure

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Check which provider is affected:
[] AWS
[x] Azure
[] Google Cloud Platform

Check which framework is affected:
[] Angular
[] Nodejs
[x] Serverless
[] Lambda
[] Infrastructure as a code

Additional context
Add any other context or screenshots about the feature request here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.