PocketBase Custom icon

PocketBase Custom

Work with PocketBase records

Overview

This node integrates with PocketBase to manage records within specified collections. The "Update with Files" operation allows users to update an existing record in a PocketBase collection while uploading and associating files with specific fields of that record. This is particularly useful when you need to modify record data and simultaneously handle file attachments, such as updating user profiles with new avatars or attaching documents to records.

Practical examples include:

  • Updating a customer record with new profile information and uploading a profile picture.
  • Modifying a product entry with updated details and adding related images or manuals.
  • Attaching multiple documents to a record while updating its metadata.

Properties

Name Meaning
Collection The name of the PocketBase collection where the record exists.
Record ID The unique identifier of the record to update.
Fields Data A set of regular field name-value pairs representing non-file data to update on the record.
Binary Property The name of the binary property in the input data that contains the files to upload.
File Field Names Comma-separated list of field names in the record that will receive the uploaded files.
Append Files Boolean flag indicating whether to append the uploaded files to existing ones instead of replacing them.

Output

The output JSON contains the updated record object returned from PocketBase after the update operation completes successfully. This includes all fields of the record, including any updated file references.

If files are uploaded, they are associated with the specified file fields in the record. The node does not output raw binary data but manages file uploads internally via multipart form data.

Example output structure (simplified):

{
  "id": "record-id",
  "field1": "value1",
  "fileField1": ["uploadedFileUrl1", "uploadedFileUrl2"],
  ...
}

Dependencies

  • Requires a PocketBase instance URL and authentication credentials, either:
    • Email and password for admin authentication, or
    • An API token for token-based authentication.
  • Uses the official pocketbase JavaScript client library (dynamically imported).
  • Requires n8n credentials configured with the PocketBase URL and authentication details.
  • Input binary data must be provided in the specified binary property containing files to upload.

Troubleshooting

  • Authentication errors: If authentication fails, verify that the email/password or API token credentials are correct and have sufficient permissions.
  • Missing files: Ensure the binary property name matches the actual binary input data property containing files.
  • File field mismatch: The number of file field names should correspond to the files being uploaded; otherwise, files may be assigned incorrectly.
  • Appending files: When using the append files option, ensure the target fields support multiple files; otherwise, files might overwrite existing ones.
  • API errors: Errors returned by PocketBase (e.g., validation errors) will be surfaced in the node output if "Continue On Fail" is enabled, or cause the workflow to error out otherwise.
  • Expansion warnings: Not applicable for this operation but relevant for get/getMany operations.

Links and References

Discussion