Skip to content

Conversation

CorentinDoue
Copy link
Contributor

@CorentinDoue CorentinDoue commented Apr 3, 2021

Fixes #232

Description

Validate the serverless configuration for google provider and the configuration of the two triggers of cloud functions (http and event)

Tests

I didn't find any test in integration with the serverless package so I tested it manually.

yarn sls package with this configuration doesn't output any warning

service: test-schema-validation
frameworkVersion: '2'
plugins:
  - serverless-google-cloudfunctions

provider:
  name: google
  stage: dev
  runtime: nodejs10
  region: us-central1
  project: my-project
  credentials: ~/.gcloud/keyfile.json
  serviceAccountEmail: 'email'
  memorySize: 512
  timeout: 90s
  environment:
    ENV_VAR_KEY: ENV_VAR_VALUE
  vpc: projects/{project_id}/locations/{region}/connectors/{connector_name}
  labels:
    test.lab_el: VALUE

package:
  exclude:
    - node_modules/**
    - .gitignore
    - .git/**

functions:
  http-function:
    handler: http
    environment:
      ENV_VAR_KEY: ENV_VAR_VALUE
    events:
      - http: path
  event-function:
    handler: http
    vpc: projects/{project_id}/locations/{region}/connectors/{connector_name}
    memorySize: 2048
    timeout: 120s
    labels:
      event_label: VALUE
    events:
      - event:
          eventType: eventType
          resource: resource

before this PR the result would have been

Serverless: Configuration warning: Unrecognized provider 'google'                                                                                                                                                  
Serverless:                                                                                                                                                                                                        
Serverless: You're relying on provider plugin which doesn't provide a validation schema for its config.                                                                                                            
Serverless: Please report the issue at its bug tracker linking: https://www.serverless.com/framework/docs/providers/aws/guide/plugins#extending-validation-schema                                                  
Serverless: You may turn off this message with "configValidationMode: off" setting    

@CorentinDoue
Copy link
Contributor Author

@medikoo @pgrzesik Do you still maintain this repo? Can one of you review it?

Copy link
Contributor

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @CorentinDoue - looks great 👍

@pgrzesik pgrzesik changed the title feat: add schema validation feat: Add schema validation Apr 9, 2021
@pgrzesik pgrzesik merged commit c332d3d into serverless:master Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Serverless: Configuration error: Unrecognized provider 'google'

2 participants