#sandeepdil

1 messages ยท Page 1 of 1 (latest)

dim socketBOT
unique reef
#

๐Ÿ‘‹ happy to help

median path
#

error screenshot

unique reef
#

would you mind sharing your code?

median path
#

var fp = fs.readFileSync(path_resolve.resolve(__dirname, "../Public/Profile/"+file_url));
console.log(fp,"fp-----------------")

    return await stripe.files.create({
        purpose: doc_for=='bank' ? 'account_requirement' : 'identity_document',
        file: {
            data: fp,
            name: file_url,
            type: 'application/octet-stream',
        },
    }).then( ( result ) => {
        console.log(result,"===========1==========>stripe_createFile")
        return result.id;
    } ).catch( (stripe_error) => {
        console.log(stripe_error,"===========2==========>stripe_createFile")
        return false;
    } );
#

var fp has buffer type already

unique reef
#

do you have a request ID?

median path
#

req id will be generated only once request will be init... but the error is in your npm package

#

i shared screenshot... see in that

unique reef
#

which version of the npm package do you have installed

median path
#

the latest i have with node version 18.7.0

#

all other apis are working fine only getting issue with files.create

unique reef
#

v12.1.1 ?

median path
#

Yes

#

?

#

any solution

unique reef
#

still investigating

#

what does console.log(fp,"fp-----------------") log ?

median path
#

Was just trying to check if fb has buffer data or not.... It has buffer data of file

unique reef
#

would you mind sharing the screenshot for this console.log

median path
strange prism
#

Hey! Taking over for my colleague.
Can you please share more details about path_resolve.resolve(__dirname, "../Public/Profile/"+file_url) ? and can you try to use an absolute path, something like `/path/to/file...``

#

Can you share your package.json too please ?

median path
#

i tried

#

same issue

strange prism
#

Can you please share your package.json ? Node (18) and Npm version also?

strange prism
median path
#

var fp = fs.readFileSync(path_resolve.resolve(__dirname, "../Public/Profile/"+file_url));
console.log(fp,"fp-----------------")

    return await stripe.files.create({
        purpose: doc_for=='bank' ? 'account_requirement' : 'identity_document',
        file: {
            data: fp,
            name: file_url,
            type: 'application/octet-stream',
        },
    }).then( ( result ) => {
        console.log(result,"===========1==========>stripe_createFile")
        return result.id;
    } ).catch( (stripe_error) => {
        console.log(stripe_error,"===========2==========>stripe_createFile")
        return false;
    } );
#

im using node 18.7.0 and stripe npm package 12.1.1

strange prism
#

Can you please do a test for me and remove path_resolve.resolve(__dirname, "../Public/Profile/"+file_url) and set absolute path /path/to/file?

median path
#

ok... wait

#

same error

#

๐Ÿ˜ฆ

strange prism
#

I invite you to share with us a simple .js file that we can reproduce the issue with...
You can refer to this sample as a base...

const stripe = require("stripe")('YOUR_SECRET_KEY');
const fs = require('fs');

app.get("/debug", async (req, res) => {
    var fp = fs.readFileSync('/path/to/file/file.jpeg');
    var file = await stripe.files.create({
        purpose: 'dispute_evidence',
        file: {
            data: fp,
            name: 'file.jpg',
            type: 'application/octet-stream',
        },
    });

    res.send({file});
});
median path
#

Ok let me try this code

dim socketBOT
median path
#

i checked , facing same issue

strange prism
#

I invite you to share a sample complete project ( with package.json) so that we can reproduce.

median path
#

ok

#

let me create a new simple project

strange prism
#

yes please

thorny topaz
#

Hi! I'm taking over my colleague. Please, let me know if you have any other questions.