Visitar URL original
Objectify key name limit (500 chars) is outdated — should support 1500 bytes as per Datastore limits · Issue #520 · objectify/objectify · GitHub
Skip to content

Objectify key name limit (500 chars) is outdated — should support 1500 bytes as per Datastore limits #520

Description

@priyanshu-reltio

Hi team,

Google Cloud Datastore has upgraded its key name limits — it now supports up to 1500 bytes for entity keys (documented here:
https://cloud.google.com/datastore/docs/concepts/limits#entities).

However, Objectify still enforces a hard limit of 500 characters in key names, as seen in classes like Key.java and PathElement.java.

Why this is an issue:
In UTF-8 encoding, a key name can be up to 1500 bytes — which could mean up to 1500 characters (if only ASCII), but fewer if multibyte UTF-8 chars are used.

The hardcoded 500-character limit is now outdated and more restrictive than Datastore’s backend, which rejects only names exceeding 1500 bytes (not characters).

Request:
Please consider updating Objectify to align with Datastore’s official limits:

Allow up to 1500 bytes (rather than 500 characters).

Ideally, validate using name.getBytes(StandardCharsets.UTF_8).length rather than name.length().

This would allow Objectify users to fully utilize Datastore’s expanded key length limits without needing to patch Objectify or bypass it using low-level Datastore client libraries.

Thank you!

Activity

  1. self-assigned this
    on May 3, 2025
  2. priyanshu-reltio commented on Jun 10, 2025

    @priyanshu-reltio
    Author

    Hi team,

    Apologies for the confusion in my previous message — The 500-character limitation we encountered was actually coming from an older version of the Datastore SDK, not from Objectify. We had raised this with the Datastore team and they’ve resolved it in the latest SDK (v2.29.0), which now properly supports key names up to 1500 bytes, in line with the official Datastore limits.

    Since Objectify is currently using Datastore SDK version 2.25.1, would it be possible to upgrade to the latest SDK version (2.29.0) in a future release? This would help users benefit from recent bug fixes and feature enhancements, including the updated key handling.

    Thanks again for your work on Objectify, and sorry for the earlier noise!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions