Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scaleway-sdk-go: http error 500 Internal Server Error: checkpermissions invalid arguments: details:{argument_name:"project_id" reason:required #298

Open
JonathanWoollett-Light opened this issue Jun 7, 2024 · 3 comments

Comments

@JonathanWoollett-Light
Copy link

JonathanWoollett-Light commented Jun 7, 2024

I have a minimal Pulumi project:

import pulumi
import lbrlabs_pulumi_scaleway as scaleway

# Create a Scaleway resource (Object Bucket).
bucket = scaleway.ObjectBucket("my-bucket")

# Export the name of the bucket.
pulumi.export("bucket_name", bucket.id)

main_function_namespace = scaleway.FunctionNamespace("mainFunctionNamespace",
    description="Main function namespace"
)
main_function = scaleway.Function("mainFunction",
    namespace_id=main_function_namespace.id,
    runtime="rust178",
    handler="handle",
    privacy="private")

I was able to deploy the bucket running pulumi up, now I wanted to test setting a basic function.

Following https://www.pulumi.com/registry/packages/scaleway/api-docs/function/ I added:

main_function_namespace = scaleway.FunctionNamespace("mainFunctionNamespace",
    description="Main function namespace"
)
main_function = scaleway.Function("mainFunction",
    namespace_id=main_function_namespace.id,
    runtime="rust178",
    handler="handle",
    privacy="private")

Updating a couple values to use a Rust handler.

This resulted in the output:

PS C:\Users\jonat\Projects\scaleway-python> pulumi up
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/JonathanWoollett-Light/scaleway-python/dev/previews/47683e1f-afe5-445e-a903-43bcfe5ce450

     Type                                 Name                   Plan
     pulumi:pulumi:Stack                  scaleway-python-dev
 +   ├─ scaleway:index:FunctionNamespace  mainFunctionNamespace  create
 +   └─ scaleway:index:Function           mainFunction           create
Resources:
    + 2 to create
    2 unchanged

Do you want to perform this update? yes
Updating (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/JonathanWoollett-Light/scaleway-python/dev/updates/4

     Type                                 Name                   Status                  Info
     pulumi:pulumi:Stack                  scaleway-python-dev    **failed**              1 error
 +   └─ scaleway:index:FunctionNamespace  mainFunctionNamespace  **creating failed**     1 error
Diagnostics:
  pulumi:pulumi:Stack (scaleway-python-dev):
    error: update failed

  scaleway:index:FunctionNamespace (mainFunctionNamespace):
    error: 1 error occurred:
        * scaleway-sdk-go: http error 500 Internal Server Error: checkpermissions invalid arguments: details:{argument_name:"project_id" reason:required}

Outputs:
    bucket_name: "fr-par/my-bucket-33205d9"

Resources:
    2 unchanged

Duration: 16s

PS C:\Users\jonat\Projects\scaleway-python>

The Rust handler is in handler.rs as (copied from https://www.scaleway.com/en/docs/serverless/functions/reference-content/code-examples/#hello-world-in-rust):

use hyper::{
    Body, Request, Response, StatusCode,
};
pub async fn handle(_req: Request<Body>) -> Response<Body> {
    Response::builder()
        .status(StatusCode::OK)
        .header("Content-type", "text/plain")
        .body(Body::from("Hello from rust"))
        .unwrap()
}
@JonathanWoollett-Light
Copy link
Author

JonathanWoollett-Light commented Jun 7, 2024

Updating to specify as project_id appears to have fixed the problem with the namespace.

Documentation should be fixed for this

Although outputs a new error with an invalid runtime. rust178 is documented as a valid runtime at https://www.scaleway.com/en/developers/api/serverless-functions/#path-functions-create-a-new-function. Updating to rust165 appears to fix this.

Again documentation should be fixed for this

It then outputs the function is wrong and must only consist of lower case alphanumeric characters. Updating mainFunction -> main-function fixes this.

Again documentation should be fixed for this

@JonathanWoollett-Light
Copy link
Author

JonathanWoollett-Light commented Jun 7, 2024

Now I'm trying to figure out how to set the function code since this create an empty and thus useless function.

@ringods
Copy link
Member

ringods commented Jun 7, 2024

@JonathanWoollett-Light can you retry with the latest version of the provider which is v1.14?

From the import line, I notice you are using an old version:

import lbrlabs_pulumi_scaleway as scaleway

Keep in mind that the ownership changed and some of the code imports need to be changed:

https://www.pulumi.com/registry/packages/scaleway/installation-configuration/#migrating-from-the-lbrlabs-package

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

No branches or pull requests

2 participants