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

Cannot download "downloadable" file from google-drive using api deck sdk / api #44

Open
mcalvinobrandcoders opened this issue Jun 27, 2023 · 0 comments

Comments

@mcalvinobrandcoders
Copy link

mcalvinobrandcoders commented Jun 27, 2023

I get this error:
Response {
[🚀exprs] size: 0,
[🚀exprs] [Symbol(Body internals)]: {
[🚀exprs] body: PassThrough {
[🚀exprs] _readableState: [ReadableState],
[🚀exprs] _events: [Object: null prototype],
[🚀exprs] _eventsCount: 5,
[🚀exprs] _maxListeners: undefined,
[🚀exprs] _writableState: [WritableState],
[🚀exprs] allowHalfOpen: true,
[🚀exprs] [Symbol(kCapture)]: false,
[🚀exprs] [Symbol(kCallback)]: null
[🚀exprs] },
[🚀exprs] stream: PassThrough {
[🚀exprs] _readableState: [ReadableState],
[🚀exprs] _events: [Object: null prototype],
[🚀exprs] _eventsCount: 5,
[🚀exprs] _maxListeners: undefined,
[🚀exprs] _writableState: [WritableState],
[🚀exprs] allowHalfOpen: true,
[🚀exprs] [Symbol(kCapture)]: false,
[🚀exprs] [Symbol(kCallback)]: null
[🚀exprs] },
[🚀exprs] boundary: null,
[🚀exprs] disturbed: false,
[🚀exprs] error: null
[🚀exprs] },
[🚀exprs] [Symbol(Response internals)]: {
[🚀exprs] type: 'default',
[🚀exprs] url: 'https://unify.apideck.com/file-storage/files/${fileId}/download',
[🚀exprs] status: 401,
[🚀exprs] statusText: 'Unauthorized',
[🚀exprs] headers: {
[🚀exprs] 'access-control-allow-credentials': 'true',
[🚀exprs] 'access-control-allow-origin': '*',
[🚀exprs] connection: 'close',
[🚀exprs] 'content-length': '322',
[🚀exprs] 'content-type': 'application/json',
[🚀exprs] date: 'Tue, 27 Jun 2023 13:06:13 GMT',
[🚀exprs] via: '1.1 c3f257ad7ec4633c503cd21a690fa4dc.cloudfront.net (CloudFront)',
[🚀exprs] 'x-amz-apigw-id': 'HLe-0HeHFiAFW2g=',
[🚀exprs] 'x-amz-cf-id': 'lp7J8MVXqXl58FiiTU3ewZbdJUkNm0TbwfExfq8KCNigrEHloMGaKw==',
[🚀exprs] 'x-amz-cf-pop': 'MIA3-C2',
[🚀exprs] 'x-amzn-requestid': 'dd57c3cf-d405-4cb2-b2f2-8ed6b60aece2',
[🚀exprs] 'x-amzn-trace-id': 'Root=1-649adec4-275a46b20ded46df2a8114a2',
[🚀exprs] 'x-cache': 'Error from cloudfront'
[🚀exprs] },
[🚀exprs] counter: 0,
[🚀exprs] highWaterMark: 10000000
[🚀exprs] }
[🚀exprs] }

when I try to download a google drive file through the sdk like this:

const apideck = new Apideck({
apiKey: process.env.API_DECK_API_KEY!,
appId: process.env.API_DECK_APP_ID!,
consumerId: consumerId,
});
let data = null;
try {
data = await apideck.fileStorage.filesDownload({
id: fileId,
consumerId,
appId: process.env.API_DECK_APP_ID,
serviceId: 'google-drive',
});
console.log('API called successfully', data);
} catch (error) {
console.error('Error: ', error);
}

same error through the api calling it like this:
await fetch(https://unify.apideck.com/file-storage/files/${fileId}/download, {
method: 'GET',
headers: {
'x-apideck-consumer-id': consumerId,
'x-apideck-app-id': process.env.API_DECK_APP_ID!,
Authorization: Bearer ${process.env.API_DECK_API_KEY!},
},
});

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

1 participant