Skip to content

Add Prisma Postgres Actions for Database Provisioning, Management & Cleanup via Prisma Management API #18092

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nurul3101
Copy link

@nurul3101 nurul3101 commented Aug 18, 2025

Hi Pipedream team! 👋

I'm from the Prisma team. This PR adds actions that allows users to automate Prisma Postgres database provisioning, management, and cleanup directly within their Pipedream workflows.

Here are the actions:
Screenshot 2025-08-18 at 6 36 44 PM

All actions have been tested and documented following Pipedream's component guidelines.

Please let me know if any changes are needed from our end.

Thank you!

Summary by CodeRabbit

  • New Features
    • Added Prisma Management API integration with actions to create/delete Postgres projects and databases, manage connection strings, list projects/databases/regions, and retrieve project/database details.
  • Documentation
    • Introduced README with integration overview, authentication steps, supported regions, parameter details, and example workflows.
  • Chores
    • Added dependency on @pipedream/platform.

@adolfo-pd adolfo-pd added the User submitted Submitted by a user label Aug 18, 2025
Copy link

vercel bot commented Aug 18, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Aug 18, 2025 1:17pm

Copy link

vercel bot commented Aug 18, 2025

@nurul3101 is attempting to deploy a commit to the Pipedreamers Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

coderabbitai bot commented Aug 18, 2025

Walkthrough

Adds a new Prisma Management API integration: introduces an app client with authenticated HTTP helpers and endpoints for projects, databases, connection strings, and regions; adds multiple action modules for create/list/get/delete operations; updates package dependencies; and includes a comprehensive README.

Changes

Cohort / File(s) Summary
Documentation
components/prisma_management_api/README.md
New README detailing integration overview, authentication, supported actions, parameters, examples, and links.
App Client
components/prisma_management_api/prisma_management_api.app.mjs
Replaces authKeys with axios-based client; adds helpers _baseUrl, _makeRequest; implements CRUD methods for projects, databases, connection strings; adds regions listing; removes authKeys().
Actions — Projects
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs, .../delete-postgres-database/delete-postgres-database.mjs, .../get-project-details/get-project-details.mjs, .../list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs
New actions to create project (and initial DB), delete project, get project details, and list projects.
Actions — Databases
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs, .../delete-database-by-database-id/delete-database-by-database-id.mjs, .../get-database-details/get-database-details.mjs, .../list-databases-from-project/list-databases-from-project.mjs
New actions to create, delete, get details, and list databases within a project.
Actions — Connection Strings
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs, .../delete-database-connection-string/delete-database-connection-string.mjs, .../list-database-connection-strings/list-database-connection-strings.mjs
New actions to create, delete, and list connection strings for a database.
Actions — Regions
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs
New action to list available Prisma Postgres regions.
Package Manifest
components/prisma_management_api/package.json
Adds dependency: @pipedream/platform ^1.5.1.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Action
  participant AppClient as Prisma App Client
  participant PrismaAPI as Prisma Management API

  User->>Action: Provide inputs (e.g., projectId, databaseId)
  Action->>AppClient: Call method (create/list/get/delete)
  AppClient->>PrismaAPI: HTTP request with Bearer token
  PrismaAPI-->>AppClient: HTTP response (data/status)
  AppClient-->>Action: Response object
  Action-->>User: Return response + $summary
Loading
sequenceDiagram
  participant User
  participant CreateProjectAction as Create Postgres Database
  participant AppClient
  participant PrismaAPI

  User->>CreateProjectAction: name, region
  CreateProjectAction->>AppClient: createProject({ name, region })
  AppClient->>PrismaAPI: POST /projects
  PrismaAPI-->>AppClient: { data: { id, database: { id } } }
  AppClient-->>CreateProjectAction: response
  CreateProjectAction-->>User: $summary with Project ID and Database ID
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested labels

action

Suggested reviewers

  • lcaresia
  • michelle0927
  • jcortes

Poem

A hare with keys of silver hue,
Hops through endpoints, bright and new.
Projects sprout, databases sing,
Strings connect—what joy they bring!
Regions mapped beneath the sky,
With one swift thump, requests all fly.
Ship it quick—let queries try! 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pipedream-component-development
Copy link
Collaborator

Thank you so much for submitting this! We've added it to our backlog to review, and our team has been notified.

@pipedream-component-development
Copy link
Collaborator

Thanks for submitting this PR! When we review PRs, we follow the Pipedream component guidelines. If you're not familiar, here's a quick checklist:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (33)
components/prisma_management_api/README.md (3)

25-31: Tighten wording and avoid hard-coding region list

Small grammar fix and suggest referencing the regions action instead of a static list to prevent drift.

-#### Create Postgres Database
-Creates a new Postgres database project via Prisma Management API. This action creates a complete project with database and provides connection string details in the response for immediate use.
+#### Create Postgres Database
+Creates a new Prisma Postgres project via the Management API. This creates a complete project with a database and provides connection-string details in the response for immediate use.
@@
-**Available regions:** us-east-1, us-west-1, eu-west-3, eu-central-1, ap-northeast-1, ap-southeast-1
+Tip: Regions evolve over time. Use the "Get Prisma Postgres Regions" action at runtime to retrieve the latest supported regions.

104-111: Align terminology: “Service Token” vs “API Token” and add minor punctuation

Use a single term throughout (Prisma docs use “Service Token”) and add periods for readability.

-This integration uses API Token authentication. You'll need to provide your Prisma Management API Service token when configuring the connection in Pipedream.
+This integration uses Service Token authentication. You'll need to provide your Prisma Management API service token when configuring the connection in Pipedream.
@@
-To obtain your API token:
-1. Log in to your Prisma account
-2. Navigate to your workspace settings
-3. Generate a new Service Token 
-4. Copy the token for use in Pipedream
+To obtain your service token:
+1. Log in to your Prisma account.
+2. Navigate to your workspace settings.
+3. Generate a new service token.
+4. Copy the token for use in Pipedream.

118-126: Minor copy edits in Example Workflows

Add punctuation and consistent phrasing.

-Trigger a workflow when a new project is created in your system, automatically provision a Prisma Postgres database, and store the connection details in your configuration management system.
+Trigger a workflow when a new project is created in your system, automatically provision a Prisma Postgres database, and store the connection details in your configuration management system.
@@
-Schedule periodic cleanup of unused databases and connection strings to maintain security and reduce costs.
+Schedule periodic cleanup of unused databases and connection strings to maintain security and reduce costs.
@@
-Create databases across multiple regions for improved performance and redundancy based on your application's geographic distribution.
+Create databases across multiple regions for improved performance and redundancy, based on your application's geographic distribution.
components/prisma_management_api/prisma_management_api.app.mjs (3)

12-21: Avoid defaulting $ to this in _makeRequest

Defaulting $ to this is unconventional and could produce confusing logs/metrics. Prefer requiring $ explicitly; callers already pass it.

-    _makeRequest({
-      $ = this, path, ...args
-    }) {
-      return axios($, {
-        url: `${this._baseUrl()}${path}`,
+    _makeRequest({
+      $, path, ...args
+    }) {
+      return axios($, {
+        url: `${this._baseUrl()}${path}`,
         headers: {
           Authorization: `Bearer ${this.$auth.api_token}`,
           "Content-Type": "application/json",
         },
         ...args,
       });
     },

23-125: URL-encode path parameters to guard against unsafe characters

Defensive encoding prevents accidental breakage if IDs ever contain reserved URL characters.

     _baseUrl() {
       return "https://api.prisma.io/v1";
     },
+    _segment(v) {
+      return encodeURIComponent(String(v));
+    },
@@
     async deleteProject({
       projectId, ...args
     }) {
       return this._makeRequest({
-        path: `/projects/${projectId}`,
+        path: `/projects/${this._segment(projectId)}`,
         method: "delete",
         ...args,
       });
     },
@@
     async getProject({
       projectId, ...args
     }) {
       return this._makeRequest({
-        path: `/projects/${projectId}`,
+        path: `/projects/${this._segment(projectId)}`,
         method: "get",
         ...args,
       });
     },
@@
     async createDatabase({
       projectId, ...args
     }) {
       return this._makeRequest({
-        path: `/projects/${projectId}/databases`,
+        path: `/projects/${this._segment(projectId)}/databases`,
         method: "post",
         ...args,
       });
     },
@@
     async listDatabases({
       projectId, ...args
     }) {
       return this._makeRequest({
-        path: `/projects/${projectId}/databases`,
+        path: `/projects/${this._segment(projectId)}/databases`,
         method: "get",
         ...args,
       });
     },
@@
     async getDatabase({
       databaseId, ...args
     }) {
       return this._makeRequest({
-        path: `/databases/${databaseId}`,
+        path: `/databases/${this._segment(databaseId)}`,
         method: "get",
         ...args,
       });
     },
@@
     async deleteDatabase({
       databaseId, ...args
     }) {
       return this._makeRequest({
-        path: `/databases/${databaseId}`,
+        path: `/databases/${this._segment(databaseId)}`,
         method: "delete",
         ...args,
       });
     },
@@
     async listConnectionStrings({
       databaseId, ...args
     }) {
       return this._makeRequest({
-        path: `/databases/${databaseId}/connections`,
+        path: `/databases/${this._segment(databaseId)}/connections`,
         method: "get",
         ...args,
       });
     },
@@
     async createConnectionString({
       databaseId, data, ...args
     }) {
       return this._makeRequest({
-        path: `/databases/${databaseId}/connections`,
+        path: `/databases/${this._segment(databaseId)}/connections`,
         method: "post",
         data: data || {},
         ...args,
       });
     },
@@
     async deleteConnectionString({
       connectionId, ...args
     }) {
       return this._makeRequest({
-        path: `/connections/${connectionId}`,
+        path: `/connections/${this._segment(connectionId)}`,
         method: "delete",
         ...args,
       });
     },

6-6: Optional: centralize common propDefinitions for reuse across actions

To reduce duplication and ensure consistent labels/descriptions across actions, consider defining shared props on the app for projectId, databaseId, and connectionId, then reference them in actions via props: { projectId: app.propDefinitions.projectId, ... }.

Example addition to prisma_management_api.app.mjs (outside current changed lines):

propDefinitions: {
  projectId: {
    type: "string",
    label: "Project ID",
    description: "The Prisma project ID.",
  },
  databaseId: {
    type: "string",
    label: "Database ID",
    description: "The Prisma Postgres database ID.",
  },
  connectionId: {
    type: "string",
    label: "Connection ID",
    description: "The connection string ID.",
  },
},
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)

17-23: Be resilient to response shape and return the payload, not the raw response

APIs sometimes return arrays directly or nest them (e.g., { regions: [] }). Compute the list defensively and return it to keep step output clean.

-    if (response) {
-      const count = response.data?.length || 0;
-      $.export("$summary", `Successfully retrieved ${count} available Postgres region${count !== 1 ? "s" : ""}`);
-    }
-
-    return response;
+    if (response) {
+      const items = Array.isArray(response.data)
+        ? response.data
+        : (response.data?.regions || []);
+      const count = Array.isArray(items) ? items.length : 0;
+      $.export("$summary", `Successfully retrieved ${count} available Postgres region${count !== 1 ? "s" : ""}`);
+      return items;
+    }
+    return response;
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (2)

4-8: Polish name/description for consistency and clarity

Title-case “Details” and tighten the description.

-  name: "Get Database details",
+  name: "Get Database Details",
@@
-  description: "Get database details of a particular Prisma Postgres database via Prisma Management API. [See docs here](https://www.prisma.io/docs/postgres/introduction/management-api)",
+  description: "Retrieve details for a Prisma Postgres database via the Prisma Management API. [See docs here](https://www.prisma.io/docs/postgres/introduction/management-api)",

23-28: Return response payload instead of the entire HTTP response

Returning response.data keeps step output clean and consistent.

-    return response;
+    return response?.data ?? response;
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (2)

23-25: Export summary unconditionally after a successful await.

If the HTTP client throws on non-2xx, this code path won’t run anyway. The extra condition can hide success summaries if the client returns undefined for 204 responses. Simplify by exporting the summary after the await.

Apply this diff:

-    if (response || response === null) {
-      $.export("$summary", `Successfully deleted database with ID ${this.databaseId}`);
-    }
+    $.export("$summary", `Successfully deleted database with ID ${this.databaseId}`);

27-31: Consider standardizing return shapes across actions.

Some actions return the raw API response, others return a { success, id, message } object. Standardizing improves DX for workflows that chain multiple actions.

components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)

7-7: Description claims pagination support but no pagination is exposed.

Currently there are no pagination props or logic passed to listProjects. Either add pagination props (e.g., cursor/page, limit) and wire them through, or adjust the description to avoid implying pagination.

Apply this minimal description fix if you prefer not to add props now:

-  description: "List Projects in a Prisma Workspace via Prisma Management API. Supports pagination for large result sets. [See docs here](https://www.prisma.io/docs/postgres/introduction/management-api)",
+  description: "List Projects in a Prisma Workspace via Prisma Management API. [See docs here](https://www.prisma.io/docs/postgres/introduction/management-api)",
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (2)

23-25: Export summary unconditionally after a successful await.

Same reasoning as other delete actions: if the API call fails it will throw. Exporting the summary unconditionally avoids edge cases where clients return undefined for 204 responses.

Apply this diff:

-    if (response || response === null) {
-      $.export("$summary", `Successfully deleted database connection with ID ${this.connectionId}`);
-    }
+    $.export("$summary", `Successfully deleted database connection with ID ${this.connectionId}`);

27-31: Tighten message wording to “connection string” for clarity.

Minor copy nit to match the action name and avoid ambiguity with other connection objects.

Apply this diff:

-      message: "Database connection deleted successfully",
+      message: "Database connection string deleted successfully",
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (2)

20-29: Consider dynamic region options sourced from the API.

Hardcoding regions can drift from reality. Prefer populating options from listRegions to ensure accuracy and better UX.

Two approaches:

  • Define a propDefinition in the app with dynamic options and reference it here.
  • Or implement a dynamic options function that queries this.app.listRegions and returns { label, value } pairs.

Happy to provide a concrete snippet if you share the app’s propDefinition patterns.


55-56: Align return shape with other actions for consistency.

This action returns the raw response, while delete actions return a { success, id, message } object. Consider standardizing across the suite (either always raw response or always a normalized object plus raw under a key).

components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (2)

23-25: Export summary unconditionally after a successful await.

Mirror the simplification suggested for the other delete actions to avoid missing summaries on 204/empty responses.

Apply this diff:

-    if (response || response === null) {
-      $.export("$summary", `Successfully deleted Postgres database project with ID ${this.projectId}`);
-    }
+    $.export("$summary", `Successfully deleted Postgres database project with ID ${this.projectId}`);

11-15: Optional: Provide dynamic options for selecting a project.

To reduce copy/paste of IDs, consider a dynamic options prop that lists projects (via listProjects) so users can pick a project by name in the UI.

components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (2)

11-16: Consider dynamic projectId via propDefinition for UX

Leverage a propDefinition (backed by listProjects) so users can pick a project from a dropdown instead of pasting IDs.

Apply this diff if projectId propDefinition exists in the app:

-    projectId: {
-      type: "string",
-      label: "Project ID",
-      description: "The ID of the project to list databases from",
-    },
+    projectId: {
+      propDefinition: [app, "projectId"],
+      description: "Select the project to list databases from",
+    },

If you don't have it yet, add to prisma_management_api.app.mjs:

// Inside export default { ... app ... }
propDefinitions: {
  projectId: {
    type: "string",
    label: "Project",
    description: "Select a Prisma project",
    async options({ $ }) {
      const res = await this.listProjects({ $ });
      const items = res?.data ?? [];
      return items.map((p) => ({ label: `${p.name} (${p.id})`, value: p.id }));
    },
  },
},

23-26: Make summary resilient to varied response shapes

If your app client ever returns arrays at the top level (vs under data), count can be wrong.

Apply:

-      const count = response.data?.length || 0;
+      const items = Array.isArray(response?.data) ? response.data : (Array.isArray(response) ? response : []);
+      const count = items.length;
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (3)

11-16: Enable databaseId selection via propDefinition

Improve DX by letting users select a database from a list (backed by listDatabases).

-    databaseId: {
-      type: "string",
-      label: "Database ID",
-      description: "The ID of the database to create a connection string for",
-    },
+    databaseId: {
+      propDefinition: [app, "databaseId"],
+      description: "Select the database to create a connection string for",
+    },

Add to prisma_management_api.app.mjs if missing:

propDefinitions: {
  // ...projectId as shown earlier...
  databaseId: {
    type: "string",
    label: "Database",
    description: "Select a database within a project",
    async options({ $ }) {
      // Optionally gate by selected projectId from other props
      // e.g. const { projectId } = this;
      // const res = await this.listDatabases({ $, projectId });
      // If no projectId context, fetch recently used or all (if API supports).
      return [];
    },
  },
},

31-33: Use robust ID fallback in summary

The ID may come as response.id or response.data.id depending on the app client shape.

-      $.export("$summary", `Successfully created connection string for database ${this.databaseId}${response.id ? ` with connection ID ${response.id}` : ""}`);
+      const id = response?.id ?? response?.data?.id;
+      $.export("$summary", `Successfully created connection string for database ${this.databaseId}${id ? ` with connection ID ${id}` : ""}`);

35-36: Be mindful of returning secrets in step output

Creating a connection string may return the raw DSN with credentials. Returning the full response is often desired, but it can expose secrets in step results. Consider a boolean prop to control whether to return the raw string or to return only metadata by default.

I can draft a small change to add a returnConnectionString boolean (default false) and conditionally filter the returned payload.

components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (3)

11-15: Tighten copy and enable dynamic selection

  • Wording: use “connection strings” for clarity.
  • Prefer propDefinition for databaseId to enable dropdown selection.
-    databaseId: {
-      type: "string",
-      label: "Database ID",
-      description: "The ID of the database to list connections for",
-    },
+    databaseId: {
+      propDefinition: [app, "databaseId"],
+      description: "The database to list connection strings for",
+    },

23-26: Defensive count calc across response shapes

Mirror the pattern suggested in the other list action for resilience.

-      const count = response.data?.length || 0;
+      const items = Array.isArray(response?.data) ? response.data : (Array.isArray(response) ? response : []);
+      const count = items.length;

17-21: Implement pagination for listConnectionStrings

The listConnectionStrings helper in
components/prisma_management_api/prisma_management_api.app.mjs (around lines 91–94)
currently just calls _makeRequest with no loop over a nextLink, so it will only return the first page of results. Likewise, the action in
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (lines 17–21)
simply forwards that call, without handling pagination.

Please update the wrapper (or the action) to:

  • Detect and follow a nextLink (or equivalent pagination token) in the response, aggregating all pages before returning.
  • Or expose standard paging controls (e.g., top, skipToken) so callers can request subsequent pages as needed.
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (3)

4-4: Title case the action name for consistency

Minor naming nit.

-  name: "Get Project details",
+  name: "Get Project Details",

11-16: Use propDefinition for project selection

Improves UX by letting users select a project from a list.

-    projectId: {
-      type: "string",
-      label: "Project ID",
-      description: "The ID of the project to retrieve information for",
-    },
+    projectId: {
+      propDefinition: [app, "projectId"],
+      description: "Select the project to retrieve information for",
+    },

23-25: Enrich summary with project name when available

Small UX win.

-      $.export("$summary", `Successfully retrieved project information for ID ${this.projectId}`);
+      const name = response?.name ?? response?.data?.name;
+      $.export("$summary", `Successfully retrieved project ${name ? `"${name}"` : `ID ${this.projectId}`}`);
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (4)

10-16: Adopt propDefinition for projectId

Facilitates selection from workspace projects.

-    projectId: {
-      type: "string",
-      label: "Project ID",
-      description: "The ID of the project where the database should be created",
-    },
+    projectId: {
+      propDefinition: [app, "projectId"],
+      description: "Select the project where the database should be created",
+    },

16-29: Prefer dynamic region options from API instead of hardcoding

Regions can change; fetch dynamically via listRegions. If you have a region propDefinition in the app, use that; otherwise add an async options function.

Option A (propDefinition):

-    region: {
-      type: "string",
-      label: "Region",
-      description: "The AWS region where the database should be created",
-      options: [
-        "us-east-1",
-        "us-west-1",
-        "eu-west-3",
-        "eu-central-1",
-        "ap-northeast-1",
-        "ap-southeast-1",
-      ],
-      optional: true,
-    },
+    region: {
+      propDefinition: [app, "region"],
+      optional: true,
+      description: "Select the region for the new database",
+    },

Add to prisma_management_api.app.mjs if missing:

propDefinitions: {
  // ...
  region: {
    type: "string",
    label: "Region",
    description: "Select a Prisma Postgres region",
    async options({ $ }) {
      const res = await this.listRegions({ $ });
      const items = res?.data ?? [];
      return items.map((r) => ({ label: `${r.name} (${r.id})`, value: r.id }));
    },
  },
},

Option B (inline async options if you prefer not to touch the app yet):

-    region: {
-      type: "string",
-      label: "Region",
-      description: "The AWS region where the database should be created",
-      options: [
-        "us-east-1",
-        "us-west-1",
-        "eu-west-3",
-        "eu-central-1",
-        "ap-northeast-1",
-        "ap-southeast-1",
-      ],
-      optional: true,
-    },
+    region: {
+      type: "string",
+      label: "Region",
+      description: "Select the region for the new database",
+      optional: true,
+      async options({ $ }) {
+        const res = await app.listRegions({ $ });
+        const items = res?.data ?? [];
+        return items.map((r) => ({ label: `${r.name} (${r.id})`, value: r.id }));
+      },
+    },

39-42: Slightly cleaner payload construction

Minor readability improvement using object spread.

-    const data = {};
-    if (this.region) data.region = this.region;
-    if (this.isDefault !== undefined) data.default = this.isDefault;
+    const data = {
+      ...(this.region && { region: this.region }),
+      ...(this.isDefault !== undefined && { default: this.isDefault }),
+    };

49-51: Use robust ID fallback in summary

Mirror the ID fallback used elsewhere.

-      $.export("$summary", `Successfully created database in project ${this.projectId}${response.id ? ` with ID ${response.id}` : ""}`);
+      const id = response?.id ?? response?.data?.id;
+      $.export("$summary", `Successfully created database in project ${this.projectId}${id ? ` with ID ${id}` : ""}`);
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 84fa60f and c17df92.

📒 Files selected for processing (15)
  • components/prisma_management_api/README.md (1 hunks)
  • components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1 hunks)
  • components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1 hunks)
  • components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1 hunks)
  • components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1 hunks)
  • components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1 hunks)
  • components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1 hunks)
  • components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1 hunks)
  • components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1 hunks)
  • components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1 hunks)
  • components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1 hunks)
  • components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1 hunks)
  • components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1 hunks)
  • components/prisma_management_api/package.json (1 hunks)
  • components/prisma_management_api/prisma_management_api.app.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.

Applied to files:

  • components/prisma_management_api/package.json
🧬 Code Graph Analysis (13)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (10)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (11)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (4)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/prisma_management_api.app.mjs (2)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (2)
  • projectId (41-41)
  • databaseId (42-42)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • data (39-39)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (11)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (11)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (2)
  • response (18-21)
  • count (24-24)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (2)
  • response (18-21)
  • count (24-24)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (2)
  • response (13-15)
  • count (18-18)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (9)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (4)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (8)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (2)
  • response (13-15)
  • count (18-18)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (2)
  • response (18-21)
  • count (24-24)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (2)
  • response (13-15)
  • count (18-18)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (11)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)
  • response (43-47)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)
  • response (32-38)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (2)
  • response (13-15)
  • count (18-18)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (2)
  • response (18-21)
  • count (24-24)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (2)
  • response (13-15)
  • count (18-18)
components/prisma_management_api/actions/get-project-details/get-project-details.mjs (5)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-postgres-regions/get-postgres-regions.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
  • response (13-15)
components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (5)
components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)
  • response (23-29)
components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/get-database-details/get-database-details.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)
  • response (18-21)
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)
components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (2)
  • response (18-21)
  • count (24-24)
🪛 LanguageTool
components/prisma_management_api/README.md

[grammar] ~25-~25: There might be a mistake here.
Context: ... This action creates a complete project with database and provides connection string...

(QB_NEW_EN)


[grammar] ~33-~33: There might be a mistake here.
Context: ... #### List Projects in Prisma Workspace Retrieves all projects within your Prism...

(QB_NEW_EN)


[grammar] ~36-~36: There might be a mistake here.
Context: ...sma workspace. #### Get Project Details Retrieves detailed information about a s...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ... retrieve #### Delete Postgres Database Removes an entire Postgres database proj...

(QB_NEW_EN)


[grammar] ~50-~50: There might be a mistake here.
Context: ... Create New Database in Existing Project Adds a new database to an existing Prism...

(QB_NEW_EN)


[grammar] ~58-~58: There might be a mistake here.
Context: ...roject #### List Databases from Project Retrieves all databases within a specifi...

(QB_NEW_EN)


[grammar] ~64-~64: There might be a mistake here.
Context: ...f the project #### Get Database Details Retrieves detailed information about a s...

(QB_NEW_EN)


[grammar] ~70-~70: There might be a mistake here.
Context: ...ase #### Delete Database by Database ID Removes a specific database by its ID. ...

(QB_NEW_EN)


[grammar] ~78-~78: There might be a mistake here.
Context: ... #### Create Database Connection String Generates a new connection string for da...

(QB_NEW_EN)


[grammar] ~85-~85: There might be a mistake here.
Context: ...n #### List Database Connection Strings Retrieves all connection strings for a s...

(QB_NEW_EN)


[grammar] ~91-~91: There might be a mistake here.
Context: ... #### Delete Database Connection String Removes a specific connection string. *...

(QB_NEW_EN)


[grammar] ~99-~99: There might be a mistake here.
Context: ...lities #### Get Prisma Postgres Regions Retrieves the list of available regions ...

(QB_NEW_EN)


[grammar] ~106-~106: There might be a mistake here.
Context: ...in Pipedream. To obtain your API token: 1. Log in to your Prisma account 2. Navigat...

(QB_NEW_EN)


[grammar] ~118-~118: There might be a mistake here.
Context: ...utomated Database Setup for New Projects Trigger a workflow when a new project is...

(QB_NEW_EN)


[grammar] ~121-~121: There might be a mistake here.
Context: ...system. ### Database Cleanup Automation Schedule periodic cleanup of unused data...

(QB_NEW_EN)


[grammar] ~124-~124: There might be a mistake here.
Context: ...s. ### Multi-Region Database Deployment Create databases across multiple regions...

(QB_NEW_EN)

🔇 Additional comments (15)
components/prisma_management_api/package.json (2)

15-17: Dependency addition looks good

Adding "@pipedream/platform": "^1.5.1" is appropriate for Pipedream actions, and you avoided adding Node built-ins as deps (per our past guidance). JSON structure is valid with the trailing comma after publishConfig.


15-17: Confirm Pipedream Platform Version Alignment

I scanned every package.json and found that:

  • components/prisma_management_api/package.json and the repo root use ^1.5.1
  • The majority of components have migrated to ^3.x
  • Several others are still on ^2.x, ^0.x or various patch versions

Such a spread of major versions can lead to subtle runtime and API differences. Please review whether this package should stay on v1, or be bumped to align with the current stable major across the repo—and then update its "@pipedream/platform" range accordingly.

components/prisma_management_api/README.md (1)

31-31: Region list verified
The explicit list in components/prisma_management_api/README.md (line 31) matches the Prisma Postgres regions documented as of August 18, 2025.

(Optional) For future-proofing, consider calling the Management API endpoint GET /regions/postgres to retrieve this list programmatically.

components/prisma_management_api/prisma_management_api.app.mjs (1)

8-11: Confirmed Prisma Management API Base URL

The base URL and version (https://api.prisma.io/v1) are correct for endpoints like /projects, /databases, /connections, and /regions/postgres. No changes required.

components/prisma_management_api/actions/delete-database-by-database-id/delete-database-by-database-id.mjs (1)

1-16: Solid action metadata and props.

Name, key, description, and props follow Pipedream conventions and clearly convey the destructive nature of the operation.

components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs (1)

12-16: LGTM: clear run flow and concise summary.

The call to this.app.listProjects and the summary export are consistent with other actions. Returning the raw response is appropriate if callers need full metadata.

Also applies to: 22-23

components/prisma_management_api/actions/delete-database-connection-string/delete-database-connection-string.mjs (2)

3-16: Well-defined destructive action and props.

Naming, description, and the connectionId prop are clear and consistent with the rest of the suite.


17-21: Parameter name verified
The deleteConnectionString method in prisma_management_api.app.mjs is declared as:

async deleteConnectionString({ connectionId, ...args }) {  }

so passing connectionId: this.connectionId is correct. No changes needed.

components/prisma_management_api/actions/create-postgres-database/create-postgres-database.mjs (1)

40-53: Nice summary assembly with conditional IDs.

Building a clear $summary that includes discovered IDs is helpful for users scanning step results.

components/prisma_management_api/actions/delete-postgres-database/delete-postgres-database.mjs (1)

1-16: Clear destructive action with accurate labeling.

Action metadata, prop definition, and description align with the create/list/get counterparts.

components/prisma_management_api/actions/list-databases-from-project/list-databases-from-project.mjs (2)

3-16: Solid action scaffold and consistent metadata

Naming, key, description, and props structure align well with other actions in this suite.


17-21: Verify cursor-based pagination for listDatabases

I didn’t see any pagination logic in the listDatabases implementation—it simply forwards projectId (and any extra args) to _makeRequest. If the Management API paginates, this action will return only the first page. Please:

  • Confirm whether this.app.listDatabases supports pagination parameters (e.g. cursor, limit, page, etc.).
  • If it does, update the action to loop through all pages (e.g. calling listDatabases with the returned cursor until no more pages).
  • If it doesn’t paginate (all results are returned at once), add a note in the docs or code comment to affirm no pagination is needed.

Also applies to the similar calls in lines 28–29 of the same file.

components/prisma_management_api/actions/create-database-connection-string/create-database-connection-string.mjs (1)

3-21: Good, follows the established action pattern

Clear props and description; run implementation matches the app method contract used elsewhere.

components/prisma_management_api/actions/list-database-connection-strings/list-database-connection-strings.mjs (1)

3-16: Consistent list action implementation

Structure, metadata, and call pattern are consistent with the rest of the actions.

components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs (1)

3-9: Well-structured action and clear description

The action follows the established pattern and is easy to follow.

Comment on lines +38 to +47
async run({ $ }) {
const data = {};
if (this.region) data.region = this.region;
if (this.isDefault !== undefined) data.default = this.isDefault;

const response = await this.app.createDatabase({
$,
projectId: this.projectId,
data,
});
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 18, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Confirm whether region is required by the API

If region is mandatory for creating a DB in an existing project, mark it required. If not, current optional behavior is fine.

I can update the prop to be required and adjust copy accordingly if the API mandates it. To check the app method and docs quickly:

Also applies to: 53-54


🏁 Script executed:

#!/bin/bash
# Look for createDatabase implementation and payload expectations
rg -n -C3 'createDatabase\s*\(' components/prisma_management_api/prisma_management_api.app.mjs

Length of output: 245


🌐 Web query:

Does the Prisma Data Platform Management API require a "region" parameter when creating a new database via the createDatabase endpoint?

💡 Result:

The Prisma Data Platform Management API does require a "region" parameter when creating a new database via the createDatabase endpoint (or when creating a project with a database). This is evident from multiple official and practical code examples:

  • The [Prisma Management API guide][5] demonstrates a code sample where region is explicitly included in the request payload for creating a project (which triggers default database creation):

    const createProjectRes = await axios.post(
      `${API_URL}/projects`,
      { name: projectName, region }, // region is required here
      { headers }
    );

    Omitting the region would likely cause the API to reject the request or default to a region based on other context, but the documented examples always specify it[5].

  • The [official API documentation and partner provisioning guide][9] emphasize sending a "database provisioning request," but do not explicitly show omission of the region, and all public guides and CLI flows for provisioning (such as npx create-db) always prompt for and include a region parameter[9].

No evidence from the documentation or reference implementations suggests that the region parameter is optional for this endpoint.

Summary:
The "region" parameter is required when creating a database with the Prisma Management API's createDatabase (or project creation) endpoint[5][9].


References:
[5] Prisma Management API "Programmatically create a new project with a database" (code sample shows required region)
[9] Partner Database Provisioning docs (further conceptual and process details, always includes region in practical flows)

Citations:


Make region input required

The Prisma Data Platform Management API mandates a region parameter when creating a new database. Please update the action’s input schema and docs accordingly.

  • In components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs, mark region as required:
     inputs: {
  • region: { type: 'string', description: 'Region for the new database' },
  • region: {
  •  type: 'string',
    
  •  description: 'Region for the new database (required by the API)',
    
  •  required: true,
    
  • },

    }
- Update any related usage examples or README entries to indicate that `region` is now mandatory.

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion
// In components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs

export default {
// … other top-level properties …

inputs: {
  region: {
    type: 'string',
    description: 'Region for the new database (required by the API)',
    required: true,
  },
  // …other inputs (projectId, isDefault, etc.)…
},

async run({ $ }) {
  const data = {};
  // `region` is now guaranteed to be present
  data.region = this.region;
  if (this.isDefault !== undefined) data.default = this.isDefault;

  const response = await this.app.createDatabase({
    $,
    projectId: this.projectId,
    data,
  });
  // …
},
};
🤖 Prompt for AI Agents
In
components/prisma_management_api/actions/create-new-database-in-existing-project/create-new-database-in-existing-project.mjs
around lines 38 to 47, the action currently treats region as optional but the
Prisma Data Platform requires region when creating a database; update the
action's input schema to mark region as required (remove optional flag/undefined
checks), ensure the runtime no longer skips setting region (validate/panic if
missing), and update any related usage examples and README entries to document
that region is a mandatory input and show an example value and format.

Copy link
Author

Choose a reason for hiding this comment

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

I'll push a commit to address the feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nurul3101 Perfect! Thank you for confirming you'll address the region parameter requirement. Looking forward to seeing the updated commit that makes region a required input for the database creation action.

Comment on lines +17 to +20
if (response) {
const count = response.data?.length || 0;
$.export("$summary", `Successfully retrieved ${count} project${count !== 1 ? "s" : ""}`);
}
Copy link
Contributor

@coderabbitai coderabbitai bot Aug 18, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify shape of response.data to avoid incorrect counts.

Assumes response.data is an array. If the app client returns { data: { items: [] } } or another shape, count will be wrong.

Run this script to inspect the listProjects implementation and confirm the response shape:


🏁 Script executed:

#!/bin/bash
# Find and show the listProjects method to confirm returned shape
rg -n -C3 'listProjects\s*\(' components/prisma_management_api/prisma_management_api.app.mjs || true

# Also search for the response handling pattern inside the app
rg -n -C3 'listProjects' components/prisma_management_api/prisma_management_api.app.mjs || true

Length of output: 530


🏁 Script executed:

#!/bin/bash
# Locate and display the full _makeRequest implementation to verify the shape of the returned payload
rg -n -C5 'async _makeRequest' components/prisma_management_api/prisma_management_api.app.mjs || true

Length of output: 102


🏁 Script executed:

#!/bin/bash
# Display the top of the SDK file to locate _makeRequest or its import
sed -n '1,100p' components/prisma_management_api/prisma_management_api.app.mjs

# Search the entire repo for the _makeRequest implementation
rg -n '_makeRequest' -C5 .

Length of output: 312673


Fix response-shape assumption in list-projects-in-prisma-workspace

Brief: Confirmed — prisma_management_api._makeRequest returns axios($, {...}) with no returnFullResponse, so callers typically get the response body directly. The action currently assumes a full axios response (response.data), which will make the count incorrect.

Files to update:

  • components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs — lines shown in PR (uses response.data?.length).
  • components/prisma_management_api/prisma_management_api.app.mjs — methods._makeRequest (returns axios(...), i.e. the body by default).

Suggested replacement (handle both possible shapes):

if (response) {
  const items = Array.isArray(response)
    ? response
    : Array.isArray(response?.data)
      ? response.data
      : [];
  const count = items.length;
  $.export("$summary", `Successfully retrieved ${count} project${count !== 1 ? "s" : ""}`);
}
🤖 Prompt for AI Agents
In
components/prisma_management_api/actions/list-projects-in-prisma-workspace/list-projects-in-prisma-workspace.mjs
around lines 17 to 20, the code assumes response is a full axios response and
uses response.data?.length which is incorrect because _makeRequest returns the
response body by default; update the logic to normalize both shapes by
extracting items as: if response is an array use it, else if response.data is an
array use that, otherwise use an empty array, then compute count = items.length
and export the summary using that count.

Copy link
Author

Choose a reason for hiding this comment

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

I'll push a commit to address the feedback.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nurul3101 Perfect! Thank you for confirming you'll address the response shape issue. The suggested normalization logic will handle both possible response formats correctly and ensure accurate project counts in the summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User submitted Submitted by a user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants