Giter Club home page Giter Club logo

serverless-scaleway-functions's Introduction

Scaleway plugin for Serverless Framework

Plugin for using Scaleway Serverless Functions and Serverless Containers with Serverless Framework.

Requirements

If you are using Scaleway IAM, you need to be the Owner of the Scaleway Organization in which the deployment will take place, or be an IAM user of the Organization with a policy granting you the necessary Permission Sets. See the IAM Overview for more information.

Quick start

  1. Export the template you wish to use (see the list here). We will use python3:
export TEMPLATE=python3
  1. Create a function from this template:
serverless create \
  --path ${TEMPLATE}-func \
  --template-url https://github.com/scaleway/serverless-scaleway-functions/tree/master/examples/${TEMPLATE}
  1. Install dependencies:
cd ${TEMPLATE}-func
npm i
  1. Deploy the function:
serverless deploy
  1. Invoke the function (note that first is the function name in this example):
serverless invoke --function first

Contents

More detailed documentation can be found in the docs folder, including:

There are also language-specific notes for Serverless Functions:

Configuration

With Serverless Framework, your functions and containers are defined in a serverless.yml file.

Each serverless.yml file corresponds to one function or container namespace.

General configuration

The following configuration is common to both functions and containers:

# The name of your namespace
service: my-namespace

# Read environment variables from a .env file
useDotenv: false

# Use of this plugin. This must not be changed
plugins:
  - serverless-scaleway-functions

# Scaleway-specific configuration
provider:
  # Must not change
  name: scaleway

  # Runtime used for functions (unless overridden)
  # List: https://www.scaleway.com/en/docs/serverless/functions/reference-content/functions-lifecycle/#available-runtimes
  runtime: python310

  # Global environment variables, used in every function/container in this namespace
  env:
    MY_VAR: "some var"
    MY_OTHER_VAR: "some other var"

  # Global secrets, used in every function/container in this namespace
  secret:
    MY_SECRET: "some secret"
    MY_OTHER_SECRET: "some other secret"

  # Optional override of Scaleway credentials
  scwToken: <scw-token>
  scwProject: <scw-project-id>

  # Scaleway region for the deploy
  scwRegion: fr-par

# Include/exclude directories
package:
  patterns:
    - "!node_modules/**"
    - "!.gitignore"
    - "!.git/**"

Function-specific configuration

To define functions, you can include a functions block:

functions:
  my-func:
    # Handler entrypoint
    handler: handler.py

    # Minimum and maximum number of instances
    minScale: 0
    maxScale: 10

    # Memory limit (in MiB)
    # Limits: https://www.scaleway.com/en/docs/serverless/functions/reference-content/functions-limitations/
    memoryLimit: 1024

    # Maximum duration a request will wait to be served before it times out (in seconds)
    # Value in string format ex: "300s" (default: 300 seconds)
    timeout: 300s

    # Runtime for this function, allows overriding provider.runtime
    runtime: node20

    # How to handle HTTP. Options: enabled (allow HTTP), disabled (block HTTP), or redirected (redirect HTTP -> HTTPS)
    httpOption: enabled

    # Controls privacy of the function. Options: public (no authentication), private (token-based authentication)
    privacy: public

    # Local environment variables, used only in this function
    env:
      LOCAL_VAR: "local var"

    # Local secrets, used only in this function
    secret:
      LOCAL_SECRET: "local secret"

    # Custom domains configured for the function
    # https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/
    custom_domains:
      - my-func.some.domain.com

    # List of events to trigger the function
    events:
      - schedule:
          rate: "1 * * * *"
          # Data passed as input in the request
          input:
            key-a: "value-a"
            key-b: "value-b"

Container-specific configuration

To define containers, you can include a custom.containers block (note that you can only have functions or custom.containers).

custom:
  containers:
    my-container:
      # Subdirectory holding the Dockerfile, cannot be used with registryImage
      directory: container/

      # Name of the registry image, cannot be used with directory
      registryImage: nginx:latest

      # Minimum and maximum number of instances
      minScale: 0
      maxScale: 10

      # Number of simultaneous requests to handle simultaneously
      maxConcurrency: 20

      # Memory limit (in MiB)
      # Limits: https://www.scaleway.com/en/docs/serverless/containers/reference-content/containers-limitations/
      memoryLimit: 1024

      # CPU limit for the container in mvCPU, chosen based on resource tiers if not set
      # Limits and tiers: https://www.scaleway.com/en/docs/serverless/containers/reference-content/containers-limitations/
      cpuLimit: 1000

      # Maximum duration a request will wait to be served before it times out (in seconds)
      # Value in string format ex: "300s" (default: 300 seconds)
      timeout: 300s

      # How to handle HTTP. Options: enabled (allow HTTP), disabled (block HTTP), or redirected (redirect HTTP -> HTTPS)
      httpOption: enabled

      # Controls privacy of the container. Options: public (no authentication), private (token-based authentication)
      privacy: public

      # Local environment variables, used only in this container
      env:
        LOCAL_VAR: "local var"

      # Local secrets, used only in this container
      secret:
        LOCAL_SECRET: "local secret"

      # Custom domains configured for the function
      # https://www.scaleway.com/en/docs/serverless/containers/how-to/add-a-custom-domain-to-a-container/
      custom_domains:
        - my-container.some.domain.com

      # List of events to trigger the container
      events:
        - schedule:
            rate: "1 * * * *"
            # Data passed as input in the request
            input:
              key-a: "value-a"
              key-b: "value-b"

Supported commands

serverless deploy

Note that by default serverless deploy applies the configuration located in your serverless.yml and removes functions in that namespace that are not in the file.

This can be switched off by setting the singleSource option to false.

serverless logs

Warning

This command is deprecated and will be removed on March 12, 2024. Please refer to the documentation (for functions and containers) to continue getting your logs. TL;DR: You can still access function and container logs conveniently via the Cockpit interface. Dedicated dashboards called "Serverless Functions Logs" and "Serverless Containers Logs" are accessible there.

The serverless logs command lets you watch the logs of a specific function or container.

You can fetch the logs of a specific function for with the --function option. You must specify the name of your function in the command.

serverless logs --function <function_or_container_name>

serverless info

The serverless info command gives you information about your functions' or containers' current deployement state in JSON format.

Unsupported commands

serverless invoke local

serverless invoke local is not supported directly but instead we provide additional packages to install close to your handler.

Documentation is available through runtimes frameworks for:

Useful links

Contributing

This plugin is developed and maintained by the Scaleway Serverless Team, but we welcome pull requests and issues, and are available to chat on our Community Slack Channels: #serverless-containers and #serverless-functions.

If you are looking for a way to contribute please read CONTRIBUTING.md. You can also look at the development documentation.

For general information about developing Serverless Framework, refer to the Serverless Framework plugins documentation.

Help & support

  • Scaleway support is available on Scaleway Console.
  • Additionally, you can join our Slack Community

Reach Us

We love feedback. Feel free to:

License

This project is MIT licensed.

serverless-scaleway-functions's People

Contributors

alelapeyre avatar almottier avatar amflint avatar bemilie avatar bene2k1 avatar dependabot[bot] avatar ldecarvalho-doc avatar lucasscw avatar n-arno avatar norbjd avatar ramychaabane avatar redanrd avatar remyleone avatar retenodus avatar shillaker avatar shywim avatar thibaultjunin avatar thomas-tacquet avatar victorluc4 avatar wouter0100 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-scaleway-functions's Issues

Error while deploying container

I'm trying to run my first container.
I have tried first manually to do so by pushing the image and creating Container using the web console. After I try to deploy I get only "Container failed with: .' when hovering over the red circle.

Then I tried to deploy using serverless and by using just your container example.
serverless create --path my-func --template-url https://github.com/scaleway/serverless-scaleway-functions/tree/master/examples/container

service: my-func
configValidationMode: off
useDotenv: true

provider:
  name: scaleway
  # Global Environment variables - used in every functions
  env:
    test: test
  # the path to the credentials file needs to be absolute
  scwToken: ${env:SCW_SECRET_KEY}
  scwProject: ${env:SCW_DEFAULT_PROJECT_ID}
  scwRegion: ${env:SCW_REGION}

plugins:
  - serverless-scaleway-functions

package:
  patterns:
    - '!node_modules/**'
    - '!.gitignore'
    - '!.git/**'

custom:
  containers:
    first:
      directory: my-container
      minScale: 1
      memoryLimit: 256
      maxScale: 2
      port: 8080
      # Local environment variables - used only in given function
      env:
        local: local`

And I do get the same error but in a different format

serverless deploy
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Creating container first...
Building and pushing container first to: rg.fr-par.scw.cloud/funcscwmyfuncjqb8s2em/first:latest ...
Deploying Containers...
Waiting for container deployments, this may take multiple minutes...
Environment: darwin, node 18.1.0, framework 3.19.0, plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Container failed with: .
    at manageError (/Users/milan/Documents/Projects/pitchflow/test-serverless/my-func/node_modules/serverless-scaleway-functions/shared/api/utils.js:20:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

What am I doing wrong or there is some problem on your side?

Also, strange thing is that when I look at images in Container Registry, all images have the size of 0bytes.

Container image not overwritten on later deployments

Steps to reproduce:

  • Deploy a container with the serverless framework
  • Change the image and tag manually in Scaleway Console
  • Redeploy with the serverless framework

I would have assumed the redeployment would overwrite the manually set image and tag, but it just seems to ignore the image/tag setting.

Description field of function not supported

If I set the description of a function like this:

functions:
  hello:
     # ...
    description: "Description of what the function does"
     # ...

it would be great if this sets the Description field of the function/container in the Scaleway Console.

Screenshot of the field in the Scaleway Console:
image

Error message for failed docker build is a bit confusing

I made a mistake in the Dockerfile that I tried to deploy as a serverless container and the error message from the serverless deploy command was this:

Using credentials from serverless.yml
Updating container app...
Building and pushing container app to: rg.nl-ams.scw.cloud/xxxx/app:latest ...
Deploying Containers...
Waiting for container deployments, this may take multiple minutes...
Environment: linux, node 14.20.0, framework 3.21.0 (local), plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
Error:
Error: Error: Error: Error: Unable to fetch image "rg.nl-ams.scw.cloud/xxxx/app:latest": failed to resolve image to digest: HEAD https://rg.nl-ams.scw.cloud/v2/xxxx/app/manifests/latest: unexpected status code 404 Not Found (HEAD responses have no body, use GET for details).
    at manageError (/builds/xxxx/xxxx/node_modules/serverless-scaleway-functions/shared/api/utils.js:20:11)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

This is a bit confusing, because the logging suggests that the build and push succeeded and the deployment after that was is the problem.
Only after I activated --verbose it became clear to me that the docker build was the problem.

Support java

It would be nice to be able to deploy functions written in java

release 0.4.0 (notes)

0.4.0

Added

  • serverless info command to work with serverless compose
  • serverless invoke command
  • Custom Domains support
  • single_source parameter

Changed

  • Documentation
  • Examples
  • Contributing guideline

While deploying: An error occured while getting a presigned URL to upload functions's archived code.

Hello,
I have this error during the deployment of my function:

An error occured while getting a presigned URL to upload functions's archived code.

Below are my environment information:

     Operating System:          linux
     Node Version:              14.17.6
     Framework Version:         2.72.3 (local)
     Plugin Version:            5.5.4
     SDK Version:               4.3.2
     Components Version:        3.18.2

And below my serverless.yaml

service: my-app
configValidationMode: off
variablesResolutionMode: 20210326
scwRegion: fr-par
provider:
    name: scaleway
    runtime: node14 # Available node runtimes are listed in documentation
    # Global Environment variables - used in every functions
    env:
        test: test
    # the path to the credentials file needs to be absolute
    scwToken: ${env:SCWTOKEN}
    scwProject: ${env:SCWPROJECT}

plugins:
    - serverless-scaleway-functions

package:
    patterns:
        - "!.gitignore"
        - "!.git/**"
        - './node_modules/**'

functions:
    myfunction:
        handler: dist/src/consumers/handlers/myfunctionhandler.handle

Do you have an idea of what is happening?

Undetailed error on deployment

Im trying to deploy a container which works well in a local Docker environment.

Stacktrace:

Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Packaging service...
Serverless: Updating container first...
Serverless: Building and pushing container first to: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ...
Serverless: Deploying Containers...
Serverless: Waiting for container deployments, this may take multiple minutes...

 Error ---------------------------------------------------

  Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error: Error:
Error: Error: Error: Error: Error: Error: Error: Error: internal error
      at manageError (/home/benjamin/serverless/node_modules/serverless-scaleway-functions/shared/api/utils.js:20:11)
      at process._tickCallback (internal/process/next_tick.js:68:7)

  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com

  Your Environment Information ---------------------------
     Operating System:          linux
     Node Version:              10.24.0
     Framework Version:         2.33.0
     Plugin Version:            4.5.3
     SDK Version:               4.2.2
     Components Version:        3.8.1

serverless.yaml

service:
  name: staging

provider:
  name: scaleway
  # Global Environment variables - used in every functions
  env:
    # env variables here...
  # the path to the credentials file needs to be absolute
  scwToken: XXXXXXXXXXXXXXXXXXXXX
  scwOrganization: XXXXXXXXXXXXXXXXXXXXX

plugins:
  - serverless-scaleway-functions

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

custom:
  containers:
    backend:
      directory: backend
      minScale: 1
      memoryLimit: 2048
      maxScale: 1
      # timeout: 20000

serverless.ts not supported?

I have created a repo with a serverless.ts instead of a serverless.yml

import ScalewayServerlessConfiguration from './src/types/ScalewayServerless'

const currentStage = process.env.TIF_STAGE as string
const scwProjectId = process.env.SCW_PROJECT_ID as string
const scwAPiToken = process.env.SCW_API_TOKEN as string

const serverlessConfiguration: ScalewayServerlessConfiguration = {
  service: `backend-hasura-handlers-${currentStage}`,
  configValidationMode: 'off',
  useDotenv: false,
  frameworkVersion: '^3.30.1',
  provider: {
    name: 'scaleway',
    runtime: 'node18',
    swcProject: scwProjectId,
    swcRegion: 'fr-par',
    swcToken: scwAPiToken,
    env: {
      TIF_STAGE: '${env:TIF_STAGE}',
      BUCKET_NAME: '${env:BUCKET_NAME}',
      S3_REGION: '${env:S3_REGION, "fr-par"}'
    },
    secret: {
      ACCESS_KEY_ID: '${env:SCW_ACCESS_KEY}',
      SECRET_KEY: '${env:SCW_SECRET_KEY}'
    }
  },
  plugins: ['serverless-esbuild', 'serverless-scaleway-functions'],
  package: {
    individually: true,
    patterns: ['!.gitignore', '!.git/**']
  },
  custom: {
    esbuild: {
      bundle: true,
      minify: false,
      sourcemap: true,
      target: 'node16',
      define: { 'require.resolve': undefined },
      platform: 'node',
      concurrency: 10
    }
  },
  functions: {
    'hello-world': {
      handler: 'src/hello-world/handler.hello-world'
    }
  }
}

console.log(serverlessConfiguration)
export default serverlessConfiguration

But when i try to deploy i run into an error

Error:
Invalid service configuration: "provider.name" property is missing
 ELIFECYCLE  Command failed with exit code 1.

 Does anyone have an idea?

Serverless container based on private image can not be deployed

I want to deploy a serverless container that uses a Dockerfile that is based on a image in the Scaleway Docker registry.

The image that I want to deploy looks something like this:

FROM rg.nl-ams.scw.cloud/some/registry:tag

RUN something

COPY . .

This fails because the build command is not authenticated in the code, only the push command.

Code for build: https://github.com/scaleway/serverless-scaleway-functions/blob/master/deploy/lib/pushContainers.js#L40
Code for push: https://github.com/scaleway/serverless-scaleway-functions/blob/master/deploy/lib/pushContainers.js#L43

stage not respected

I am deploying a container with different sages, both are built and pushed to the container registry and deployed on the namespace/container.

They should be different when running these two commands:

serverless deploy --stage preview
serverless deploy --stage production

But the second one replaces the first one.

How can I deploy to different stages?

Error using dependencies in functions

Hello there,

I'm trying to use a NodeJS14 Scaleway Functions to add features to a Scaleway Object Storage bucket.
But, I can't find the way to use needed dependencies in my function...

When I initiate my two dependencies in the code, like this :

const AWS = require('aws-sdk');
const Sharp = require('sharp');

After installed both dependencies with npm install aws-sdk sharp, and getting the package.json's dependencies part correctly filled.

I got this response (after deployment) when I try to fetch the function over http :

An error occured during handler execution: Function Handler does not exist, check that you provided the right HANDLER parameter (path to your module with exported function to use)

However, without both import lines, the function is correctly working !

Could you help me please ?

Here my first test function :

const AWS = require('aws-sdk');
const Sharp = require('sharp');

module.exports.handle = (event, context, callback) => {

  const photoId = event.queryStringParameters.id;
  const size = event.queryStringParameters.size;

  const result = {
    message: 'Hello from Serverless Framework and Scaleway Functions :D',
    photoId: photoId,
    size: size
  };
  const response = {
    statusCode: 200,
    body: JSON.stringify(result),
  };

  return response;
};

And the corresponding serverless.yml :

service:
  name: MyFunctions
configValidationMode: off
provider:
  name: scaleway
  runtime: node14
  scwToken: '***'
  scwOrganization: '***'

plugins:
  - serverless-scaleway-functions

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

functions:
  first:
    handler: handler.handle
    env:
      ACCESS_KEY: '***'
      SECRET_KEY: '***'
      BUCKET: '***'

Receiving an error to a function invoke raises an exception

✖ Uncaught exception
/Users/a/a/scaleway-scheduler/node_modules/serverless/scripts/serverless.js:53
        throw error;
        ^

TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of AxiosError
    at new NodeError (node:internal/errors:399:5)
    at _write (node:internal/streams/writable:315:13)
    at Writable.write (node:internal/streams/writable:337:10)
    at WriteStream.<anonymous> (/Users/a/a/a/node_modules/cli-progress-footer/lib/private/cli-progress-footer/override-std-props.js:56:5)
    at stream.write (/Users/a/a/a/node_modules/process-utils/lib/private/get-override-stream-write.js:12:54)
    at /Users/a/a/a/node_modules/serverless-scaleway-functions/invoke/scalewayInvoke.js:65:24
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Switching line 65 of scalewayInvoke.js to process.stderr.write(error.toString()); will return the error (which was a 403 in my situation).

Add support for "serverless info"

Currently, using serverless info yield an error with the scaleway plugin:

$ serverless info
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Using credentials from system environment
Environment: darwin, node 17.8.0, framework 3.16.0, plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at resolveArgsSchema (/usr/local/lib/node_modules/serverless/lib/cli/resolve-input.js:13:45)
    at /usr/local/lib/node_modules/serverless/lib/cli/resolve-input.js:41:5
    at memoized (/usr/local/lib/node_modules/serverless/node_modules/memoizee/lib/configure-map.js:80:41)
    at /usr/local/lib/node_modules/serverless/scripts/serverless.js:610:15
    at /usr/local/lib/node_modules/serverless/scripts/serverless.js:745:9

Add support for dependabot

I think some of the dependencies used are deprecated. Could you add support for dependabot so that you have automatic notification when a dependency goes out of date and have a PR to fix it?

Rate limit error when deploying a lot of functions with trigger

When deploying ~20 functions with ~10 triggers each, serverless deploy hits rate limits

Deploying triggers...
Environment: linux, node 16.18.1, framework 3.25.1, plugin 6.2.2, SDK 4.3.2
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: AxiosError: Request failed with status code 429
    at manageError (/github/workspace/node_modules/serverless-scaleway-functions/shared/api/utils.js:20:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 3)
    at async Promise.all (index 1)

The code handling deployment:

https://github.com/scaleway/serverless-scaleway-functions/blob/master/deploy/lib/deployTriggers.js#L19-L23

could be improved in my opinion to avoid hitting rates limits:

  • It does all the requests in parallel (per function and per trigger), so x functions with y triggers will generate x*y parallel requests to the scaleway API.
  • It always deletes and recreate all triggers even if there are no changes.

Deploy triggers internal error

I get an error when I try to deploy a package.

The new function is correctly deployed and runs without an issue.

The command line returns an error and the Scaleaway website shows an error as well...

Screenshot 2020-10-30 at 20 29 37

$ sls deploy --scw-token=`cat .scw-token` --scw-organization=`cat .scw-organization-id`

Serverless: Using credentials from command line parameters
Serverless: Using credentials from command line parameters
Serverless: Using credentials from command line parameters
Serverless: Using credentials from command line parameters
Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Updating function sendmail...
Serverless: Uploading source code...
Serverless: Deploying Functions...
Serverless: Waiting for function deployments, this may take multiple minutes...
 
  Error --------------------------------------------------
 
  Error: internal error
      at listFunctions.then (/Users/charles/serverless/serverless-scaleway-functions/shared/api/functions.js:45:19)
      at process._tickCallback (internal/process/next_tick.js:68:7)
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Issues:        forum.serverless.com
 
  Your Environment Information ---------------------------
     Operating System:          darwin
     Node Version:              10.15.1
     Framework Version:         1.65.0
     Plugin Version:            3.8.4
     SDK Version:               2.3.2
     Components Version:        2.34.9
 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] deploy: `sls deploy --scw-token=`cat .scw-token` --scw-organization=`cat .scw-organization-id``
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] deploy 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/charles/.npm/_logs/2020-10-30T18_49_52_601Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/Users/charles/.nvm/versions/node/v10.15.1/bin/node',
1 verbose cli   '/Users/charles/.nvm/versions/node/v10.15.1/bin/npm',
1 verbose cli   'run',
1 verbose cli   'deploy' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle [email protected]~predeploy: [email protected]
6 info lifecycle [email protected]~deploy: [email protected]
7 verbose lifecycle [email protected]~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~deploy: PATH: /Users/charles/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/charles/Pidoco/serverless/node_modules/.bin:/Users/charles/.rvm/gems/ruby-2.5.2/bin:/Users/charles/.rvm/gems/ruby-2.5.2@global/bin:/Users/charles/.rvm/rubies/ruby-2.5.2/bin:/Users/charles/.yarn/bin:/Users/charles/.config/yarn/global/node_modules/.bin:/Users/charles/.nvm/versions/node/v10.15.1/bin:/Users/charles/.composer/vendor/bin:/Users/charles/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/charles/.rvm/bin:/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/bin
9 verbose lifecycle [email protected]~deploy: CWD: /Users/charles/serverless
10 silly lifecycle [email protected]~deploy: Args: [ '-c',
10 silly lifecycle   'sls deploy --scw-token=`cat .scw-token` --scw-organization=`cat .scw-organization-id`' ]
11 silly lifecycle [email protected]~deploy: Returned: code: 1  signal: null
12 info lifecycle [email protected]~deploy: Failed to exec deploy script
13 verbose stack Error: [email protected] deploy: `sls deploy --scw-token=`cat .scw-token` --scw-organization=`cat .scw-organization-id``
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/Users/charles/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/Users/charles/.nvm/versions/node/v10.15.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/charles/Pidoco/serverless
16 verbose Darwin 19.6.0
17 verbose argv "/Users/charles/.nvm/versions/node/v10.15.1/bin/node" "/Users/charles/.nvm/versions/node/v10.15.1/bin/npm" "run" "deploy"
18 verbose node v10.15.1
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] deploy: `sls deploy --scw-token=`cat .scw-token` --scw-organization=`cat .scw-organization-id``
22 error Exit status 1
23 error Failed at the [email protected] deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Error when deploying Serverless Function

I get the following error on two different computers when following the steps from this tutorial

Command:
serverless deploy

Error:
Error: Error: Not authorized at manageError (D:\directory\myProject\node_modules\serverless-scaleway-functions\shared\api\utils.js:23:11) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

serverless.yml

configValidationMode: off
singleSource: false
provider:
  name: scaleway
  runtime: node16 # Available node runtimes are listed in documentation
  # Global Environment variables - used in every functions
  env:
    test: test
  scwToken: token
  scwProject: project
  scwRegion: fr-par

plugins:
  - serverless-scaleway-functions

package:
  patterns:
    - "!.gitignore"
    - "!.git/**"

functions:
  first:
    handler: handler.handle
    httpOption: redirected
    # description: ""
    # Local environment variables - used only in given function
    env:
      local: local

package.json

  "name": "myProject",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "serverless-scaleway-functions": "^0.4.5"
  },
  "description": ""
}

Support private functions and passing context in `serverless invoke`

As far as I understand the code, the serverless invoke command is currently missing two important features.

  1. It does not work with private functions/containers.
  2. I can not pass any context with arguments like --context, --data, --contextPath, --raw and --env to the invoked function.

Are there any plans to add this in the near future?

Allow `scwToken` to be declared out from the `serverless.yaml`

Hi,

I'm using the serverless framework along with this plugin to manage my FaaS. I'm also using the scaleway-cli.

I think the serverless.yaml file should be commited in my git repository, but I won't commit a secret token.

I've seen that page: https://www.serverless.com/framework/docs/providers/aws/cli-reference/config-credentials , but I don't know exactly what is supposed to be the key or the secret.

Would it be possible to load the secret key from another file, an env var, or even the scaleway-cli config ?

Cheers

Docker image tag for each container deployment

Currently, the container deployment process just pushes into the latest tag.
It would be great if the deployment process would create a new tag for each deployment.
At the moment, if I deploy something and the build succeeds, but the running container does not work (f.e. because of a bug in the applications code), as far as I understand the current system, there is no fast way to roll back.
With a tag per deployment I could change just change the tag in the Scaleway Console and redeploy which is way faster than having to rebuild the previous state and then deploy.

Scaleway Redis TLS cert and Promise-based programming

So, I've tried again with Redis last night. If you really care about the product, I would recommend & request the following: Provide at least one official Scaleway example for Redis Python3 and one for NodeJS using => Promises() on client.connectClient() and client.set(), but most importantly, display how to properly connect to a Remote Scalway Redis with which TLS parameters. Google is inconclusive on how to use the Certificate that you provide so smoothly.

If you want to rock it, and actually sell some of these things, provide an example of how to use it with Serverless functions AND Redis Persistence. Maybe offer Redis Enterprise. Redis, the Community version, so far, has to the best of my knowledge, two Persistence features, allowing to use it as a Primary Database rather than a Cache (which is great, Fields, .set/.get) and dynamic storage of Javascript type Objects, is much faster, and much comfortable, than dynamic or static creating of SQL statements.

I meanwhile set up a local address Redis, and that works smoothly, but I could still use an Example for how to use it with either TypeScript Express.JS properly or Python3 Flask.

Define images instead of building them

Hi there! As we have a somewhat special build-process for our images, I would prefer a solution, where I can pass an image name when deploying containers, instead of building them via the serverless yaml. Do you think that would be feasible?

No validation schema

The last version of serverless shows a warning

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
Framework Core: 2.9.0
Plugin: 4.1.1
SDK: 2.3.2
Components: 3.3.0

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.