pulumi-scaleway icon indicating copy to clipboard operation
pulumi-scaleway copied to clipboard

Cannot submit function : `handler value is invalid`

Open JesusTheHun opened this issue 9 months ago • 1 comments

I'm trying to deploy a serverless function using this code :

const provider = new scaleway.Provider('scaleway-par-2', {
  region: 'fr-par',
});

const coreApiFunctionNamespace = new scaleway.FunctionNamespace('coreApi', undefined, { provider });
const coreApiFunction = new scaleway.Function(
  'mainFunction',
  {
    description: 'Core API',
    namespaceId: coreApiFunctionNamespace.id,
    runtime: 'node20',
    handler: 'function.handle',
    privacy: 'public',
    maxScale: 5,
    deploy: true,
    zipFile: lambda.zipFilePath,
    zipHash: lambda.zipFileHash,
  },
  { provider }
);

Which ends up with this error :

scaleway-sdk-go: http error 400 Bad Request: function name must consist of lower case alphanumeric characters or '-', starts and ends with an alphanumeric character

So I tried to rename my function file to handler.js and used handle for the handler property, which got me this error :

scaleway-sdk-go: http error 400 Bad Request: handler value is invalid

The function works fine locally and the archive is valid. I uploaded the exact same archive with function.handle as a handler from the Scaleway dashboard, and it works just fine, the deployment is ok and I've got a response when I invoke the function.

Versions:

@pulumi/pulumi: 3.82.0
@lbrlabs/pulumi-scaleway: 1.7.0

I don't use version 1.10.0 because it's broken. See #250 #251 #252.

JesusTheHun avatar Sep 13 '23 08:09 JesusTheHun