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

Accessing promise index instead of index' result #67

Closed
CaporalDead opened this issue Jun 4, 2024 · 6 comments
Closed

Accessing promise index instead of index' result #67

CaporalDead opened this issue Jun 4, 2024 · 6 comments

Comments

@CaporalDead
Copy link
Contributor

Summary:

There is a priority problem between the promise/await and array access. Fix this by prioritizing the promise result over then array access. It was causing the following error :

/home/XXXXX/project/src/applications/business/XXXX.ts:5
import {useStorage} from "../../storage";
                                                         ^
Error: An error occurred while trying to generate a signed URL
    at /home/XXXXX/project/src/applications/business/XXXX.ts:114:15
    at Generator.next (<anonymous>)
    at fulfilled (/home/XXXXX/project/src/applications/business/XXXX.ts:5:58)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

The code to reproduce

const storage = new Storage({
  type: StorageType.GCS,
  keyFilename: '/path/key.json',
  bucketName: 'my-bucket',
});

await storage.getFileAsURL(data.file.path, {
  useSignedUrl: true,
  expiresOn: Date.now() + 1000 * 60 * 60, // one hour
});

Tested on:

Node 20.12.2
NPM 10.5.0

Fix proposal

See #66

@CaporalDead
Copy link
Contributor Author

CaporalDead commented Jun 9, 2024

Hey guys, any chance to see this fix reviewed (and merged 😁) ?

Thanks for your feedback 🙏 !

@CaporalDead
Copy link
Contributor Author

Thanks @abudaan 🙏 . I didn't update the version number but I wrote the CHANGELOG with the Unreleased tag. Didn't know if I had to bump the version number manually.

@CaporalDead
Copy link
Contributor Author

CaporalDead commented Jun 10, 2024

Oupsy, I just saw that I think that I didn't update the right CHANGELOG oO. Do I have to make a new PR to fix this ?

@abudaan
Copy link
Member

abudaan commented Jun 10, 2024

No problem :)

Thanks for your fix!

@abudaan abudaan closed this as completed Jun 10, 2024
@CaporalDead
Copy link
Contributor Author

CaporalDead commented Jun 10, 2024

@abudaan , I think that the npm update for the GCS adapter is missing, it's still 1.0.7 instead of 1.0.8 :) (https://www.npmjs.com/package/@tweedegolf/sab-adapter-google-cloud)

@CaporalDead
Copy link
Contributor Author

Hi @abudaan, me again 😅 , sorry to bother you (again) but I think something went wrong with the build. I saw you tagged 1.0.8 but the output code does not include the patch.

I git cloned your last commit, run npm i && npm run prepare to replay the build as I did before and I can see that the fix is present in the publish/AdapterGoogleCloud/dist/AdapterGoogleCloud.js file.

Not sure of what's going on here 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants