Skip to content
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

getSignedUrl called synchronously ? #251

Closed
andreij opened this issue Oct 9, 2014 · 2 comments
Closed

getSignedUrl called synchronously ? #251

andreij opened this issue Oct 9, 2014 · 2 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.

Comments

@andreij
Copy link

andreij commented Oct 9, 2014

I have a simple functions that returns a signed url :

  var   options = config.gs
    ,   expires = Math.round(Date.now() / 1000) + (60 * 60 * 24 * 14)
    ,   bucket  = project.storage.bucket({bucketName: config.gs.bucket, credentials: config.gs })

  options.action  = 'read'
  options.expires =  expires// 2 weeks.
  options.resource= url

  signed_url = bucket.getSignedUrl(options, function(err, url_signed) {})
  return signed_url

I cannot understand how to call it synchronously.

The signed_url is always undefined but inside the callback the url_signed is correctly set.

So if I log the signed_url and the url_signed i get:

signed_url: undefined
url_signed: http://.......
@stephenplusplus
Copy link
Contributor

I think this is the fault of our documentation. http://googlecloudplatform.github.io/gcloud-node/#/docs/v0.8.0/storage?method=getSignedUrl shows that it's returned synchronously, but that's actually not the case. You have to use it asynchronously as you've discovered.

Internally, a connection is required in order to generate a signed url, which is why it must be async. Sorry for the confusion and thanks for bringing attention to this-- I'll go and update the example.

@stephenplusplus
Copy link
Contributor

Fixed here: 5def8e7

@jgeewax jgeewax added api: datastore Issues related to the Datastore API. api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue. and removed api: datastore Issues related to the Datastore API. labels Feb 2, 2015
@jgeewax jgeewax added this to the Storage Stable milestone Feb 2, 2015
sofisl pushed a commit that referenced this issue Oct 13, 2022
- [ ] Regenerate this pull request now.

Committer: @summer-ji-eng
PiperOrigin-RevId: 434859890

Source-Link: googleapis/googleapis@bc2432d

Source-Link: googleapis/googleapis-gen@930b673
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTMwYjY3MzEwM2U5MjUyM2Y4Y2ZlZDM4ZGVjZDdkM2FmYWU4ZWJlNyJ9
sofisl pushed a commit that referenced this issue Nov 10, 2022
* updated CHANGELOG.md [ci skip]

* updated package.json [ci skip]

* updated samples/package.json [ci skip]
sofisl pushed a commit that referenced this issue Nov 10, 2022
* updated CHANGELOG.md [ci skip]

* updated package.json [ci skip]

* updated samples/package.json [ci skip]
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
Source-Author: Benjamin E. Coe <[email protected]>
Source-Date: Wed Aug 12 12:12:29 2020 -0700
Source-Repo: googleapis/synthtool
Source-Sha: 5747555f7620113d9a2078a48f4c047a99d31b3e
Source-Link: googleapis/synthtool@5747555
sofisl pushed a commit that referenced this issue Nov 11, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
* test: use fully qualified request type name in tests

PiperOrigin-RevId: 475685359

Source-Link: googleapis/googleapis@7a12973

Source-Link: googleapis/googleapis-gen@370c729
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzcwYzcyOWUyYmEwNjJhMTY3NDQ5YzI3ODgyYmE1ZjM3OWM1YzM0ZCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 11, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 474338479

Source-Link: googleapis/googleapis@d5d35e0

Source-Link: googleapis/googleapis-gen@efcd3f9
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWZjZDNmOTM5NjJhMTAzZjY4ZjAwM2UyYTFlZWNkZTZmYTIxNmEyNyJ9
sofisl pushed a commit that referenced this issue Nov 11, 2022
…ript generator. (#251)

Also removing the explicit generator tag for the IAMPolicy mixin for the kms and pubsub APIS as the generator will now read it from the .yaml file.

PiperOrigin-RevId: 385101839

Source-Link: googleapis/googleapis@80f4042

Source-Link: googleapis/googleapis-gen@d3509d2
sofisl pushed a commit that referenced this issue Nov 11, 2022
🤖 I have created a release \*beep\* \*boop\*
---
### [2.2.7](https://www.github.com/googleapis/nodejs-cloudbuild/compare/v2.2.6...v2.2.7) (2021-07-21)


### Bug Fixes

* Updating WORKSPACE files to use the newest version of the Typescript generator. ([#251](https://www.github.com/googleapis/nodejs-cloudbuild/issues/251)) ([7bc5f7f](https://www.github.com/googleapis/nodejs-cloudbuild/commit/7bc5f7ff6c1485baaf1444a608d8ebb88ad20cfe))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
sofisl pushed a commit that referenced this issue Nov 11, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [gts](https://togithub.com/google/gts) | devDependencies | major | [`^2.0.0` -> `^3.0.0`](https://renovatebot.com/diffs/npm/gts/2.0.2/3.0.1) |

---

### Release Notes

<details>
<summary>google/gts</summary>

### [`v3.0.1`](https://togithub.com/google/gts/blob/master/CHANGELOG.md#&#8203;301-httpswwwgithubcomgooglegtscomparev300v301-2020-10-12)

[Compare Source](https://togithub.com/google/gts/compare/v3.0.0...v3.0.1)

### [`v3.0.0`](https://togithub.com/google/gts/blob/master/CHANGELOG.md#&#8203;300-httpswwwgithubcomgooglegtscomparev202v300-2020-10-08)

[Compare Source](https://togithub.com/google/gts/compare/v2.0.2...v3.0.0)

##### ⚠ BREAKING CHANGES

-   change default `check` to `lint` ([#&#8203;570](https://togithub.com/google/gts/issues/570))
-   **deps:** require TypeScript 4.x ([#&#8203;565](https://togithub.com/google/gts/issues/565))

##### Features

-   Add TypeScript v4 support ([#&#8203;551](https://www.github.com/google/gts/issues/551)) ([0883956](https://www.github.com/google/gts/commit/08839565a1d2b4b39d532c9b0b596f01b18856fe))
-   change default `check` to `lint` ([#&#8203;570](https://www.github.com/google/gts/issues/570)) ([c527b66](https://www.github.com/google/gts/commit/c527b66be1ef6a78ea14b3d29225a8d7fb7097bd))
-   generate .eslintignore when running init ([#&#8203;521](https://www.github.com/google/gts/issues/521)) ([8bce036](https://www.github.com/google/gts/commit/8bce0368767f0c2ad7d0700deb839962bc928d16))

##### Bug Fixes

-   add build/.eslintrc.json to files field ([#&#8203;553](https://www.github.com/google/gts/issues/553)) ([3b516ad](https://www.github.com/google/gts/commit/3b516ad5e9f0d58201dde469461db7c6ed1c1b78))
-   **deps:** require TypeScript 4.x ([#&#8203;565](https://www.github.com/google/gts/issues/565)) ([cbc5267](https://www.github.com/google/gts/commit/cbc5267579ef24e8c8ceaa2ef794df3ef54ea56a))
-   **deps:** update dependency update-notifier to v5 ([#&#8203;574](https://www.github.com/google/gts/issues/574)) ([9a882bf](https://www.github.com/google/gts/commit/9a882bf4ac30ad06e7b91a65ad5721d8e8b41c4b))
-   **deps:** update typescript-eslint monorepo to v2.34.0 ([#&#8203;509](https://www.github.com/google/gts/issues/509)) ([998a4ac](https://www.github.com/google/gts/commit/998a4ac9b75c97f04d8e5db37563f32d31652f23))
-   **deps:** update typescript-eslint monorepo to v3 (major) ([#&#8203;528](https://www.github.com/google/gts/issues/528)) ([e22e173](https://www.github.com/google/gts/commit/e22e17338db2ddb7eb829c821037c2f4e77ff869))
-   **deps:** update typescript-eslint monorepo to v4 ([#&#8203;556](https://www.github.com/google/gts/issues/556)) ([54148df](https://www.github.com/google/gts/commit/54148dfbd8b5f8b36a0f44f901c5db933393a661))
-   better error message for broken tsconfig.json ([#&#8203;501](https://www.github.com/google/gts/issues/501)) ([0c17a76](https://www.github.com/google/gts/commit/0c17a76c6650eee1d8abaff11a897a432eeaa65f))
-   prohibit calls for it.only and describe.only ([#&#8203;499](https://www.github.com/google/gts/issues/499)) ([071c33c](https://www.github.com/google/gts/commit/071c33ceef0e3765166aaebf6ed4698167ac0f98))

##### [2.0.2](https://www.github.com/google/gts/compare/v2.0.1...v2.0.2) (2020-05-11)

##### Bug Fixes

-   Revert 'update dependency eslint to v7'" ([#&#8203;507](https://www.github.com/google/gts/issues/507)) ([0f9950b](https://www.github.com/google/gts/commit/0f9950b273329dbcce5f3cc20864c3dcd076f08c))
-   **deps:** pin release of eslint-typescript ([#&#8203;508](https://www.github.com/google/gts/issues/508)) ([bd86b42](https://www.github.com/google/gts/commit/bd86b42e2bb904d3765dee82262e4691a11b9958))
-   **deps:** update dependency eslint to v7 ([#&#8203;504](https://www.github.com/google/gts/issues/504)) ([6aee159](https://www.github.com/google/gts/commit/6aee1595d0486ae2c7fd68d16b1b59c4c4015753))

##### [2.0.1](https://www.github.com/google/gts/compare/v2.0.0...v2.0.1) (2020-05-07)

##### Bug Fixes

-   throw an error if running with an unsupported version of nodejs ([#&#8203;493](https://www.github.com/google/gts/issues/493)) ([94fdf1e](https://www.github.com/google/gts/commit/94fdf1eaed634aa73c3e44c7a3d9f1325f773b07))
-   **deps:** update dependency meow to v7 ([#&#8203;502](https://www.github.com/google/gts/issues/502)) ([cf91cda](https://www.github.com/google/gts/commit/cf91cda1afab25759427511d3c97d0037d61c649))

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-talent).
sofisl pushed a commit that referenced this issue Nov 18, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.5.2` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/7.5.2/9.0.0) |

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-security-center).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

3 participants