Repository navigation
Datastore client not getting ProjectID from env #1092
Description
Activity
Good catch, thanks for letting us know. PR incoming!
- addedtype: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.api: datastoreIssues related to the Datastore API.Issues related to the Datastore API.
on Jan 27, 2016 im not sure if other clients also have this problem. I though they all extend the same base class?
I checked, all of the other APIs do it.
@callmehiphop can you think of a way we can move the normalizing to the Service constructor?
@stephenplusplus we should be able to just normalize them in the Service constructor, no?
I think there might be an issue with double-instantion?
On Thu, Jan 28, 2016, 11:01 AM Dave Gramlich [email protected]
wrote:@stephenplusplus https://github.com/stephenplusplus we should be able
to just normalize them in the Service constructor, no?—
Reply to this email directly or view it on GitHub
#1092 (comment)
.Service.call(...)only gets called once IIRC - after a service class has been instantiated.. right?Using this as an example: https://github.com/GoogleCloudPlatform/gcloud-node/blob/30817fcc10195da0136baefeb38b225986fb1c7e/lib/storage/index.js#L87-L90
if (!(this instanceof Storage)) { options = util.normalizeArguments(this, options); return new Storage(options); }
Why do we only normalize if it's not an instance of Storage?
Related: #845 (comment)
Why do we only normalize if it's not an instance of Storage?
If the current context is not an instance of a service (e.g.
Storage), that implies that the context is probablygcloud, which is where we store global config.So I'm wondering, since we only normalize under that condition, how do we move that logic to the Service constructor?
So I'm wondering, since we only normalize under that condition, how do we move that logic to the Service constructor?
Ahh right, not sure if there's a way around that.. we might have to re-think things a little bit if we want to try and refactor that logic into the
Serviceclass.3 remaining items
- added a commit that references this issue
on Jan 28, 2026 - added 2 commits that reference this issue
on Mar 5, 2026 - added a commit that references this issue
on Mar 27, 2026 - added a commit that references this issue
on May 5, 2026
It looks like Datastore client is not getting the projectID from the env automatically.
This works fine, but:
returns:
This fixes the problem