Pocketbase Append Image icon

Pocketbase Append Image

Get data from Pocketbase

Overview

This node appends an image to a specified record in a Pocketbase collection. It authenticates with Pocketbase using provided credentials, retrieves the target record, and adds a new image file to an existing image column (which is expected to be an array of images). The image is supplied as a Base64-encoded string and uploaded as a PNG file.

Common scenarios include:

  • Adding additional images to a record without overwriting existing ones.
  • Managing image galleries or multiple photos associated with a single database entry.
  • Automating image uploads to Pocketbase collections from other workflows.

Example: You have a "products" collection where each product can have multiple images. This node lets you append a new product photo to the existing images array for a specific product by its row ID.

Properties

Name Meaning
Collection The name of the Pocketbase collection you want to work on.
Column The column in the collection where images are stored (expected to be an array).
Row ID The unique identifier of the record (row) you want to update.
Image in Base64 The image data encoded as a Base64 string that you want to upload and append.

Output

The node outputs an array of JSON objects, each containing:

  • image_url: A URL string pointing to the newly appended image file hosted on the Pocketbase server.

The output structure per item looks like:

{
  "image_url": "https://your-pocketbase-url/api/files/{collection}/{recordId}/{filename}"
}

No binary data is outputted; only URLs referencing the uploaded images.

Dependencies

  • Requires a Pocketbase instance accessible via URL.
  • Needs credentials including:
    • Pocketbase URL
    • Username and password for authentication
    • User collection name (for login)
  • Uses the Pocketbase JavaScript SDK for API interactions.
  • Uses Axios for HTTP PATCH requests to update records.
  • Requires n8n credential configuration to securely store and provide these credentials.

Troubleshooting

  • Authentication failed!
    This error occurs if the node cannot authenticate with Pocketbase using the provided credentials.
    Resolution: Verify the Pocketbase URL, username, password, and user collection are correct and that the user has permission to update records.

  • Invalid collection or row ID
    If the specified collection or row ID does not exist, the node will fail when trying to fetch or update the record.
    Resolution: Double-check the collection name and row ID values.

  • Column is not an array
    The node expects the target column to hold an array of images. If it is not an array, appending may fail or overwrite data.
    Resolution: Ensure the column is configured to store multiple files/images.

  • Malformed Base64 image string
    If the image string is not valid Base64, the upload will fail.
    Resolution: Confirm the image input is correctly Base64 encoded.

Links and References

Discussion