project_ai_mern_image_generation icon indicating copy to clipboard operation
project_ai_mern_image_generation copied to clipboard

Getting error when I am clicking generate image "type error : failed to fetch "

Open vatsal1812 opened this issue 1 year ago • 21 comments

@TidbitsJS can you please help ??

vatsal1812 avatar Jul 01 '23 11:07 vatsal1812

@vatsal1812 share the screen shot of the code

shukabum avatar Jul 02 '23 14:07 shukabum

@vatsal1812 share your code screenshot

abhiram-edupuganti avatar Jul 18 '23 16:07 abhiram-edupuganti

typeerror2 typeerror1

SETHEAD avatar Aug 01 '23 14:08 SETHEAD

@vatsal1812 share your code screenshot

please let me know what to do with the error. I've attached the screenshot of the error in another reply.

If you want the screenshot of the code, please let me know of which page or code file name you want the screenshot.

SETHEAD avatar Aug 01 '23 14:08 SETHEAD

Same problem with me also

ajinkyap12 avatar Aug 04 '23 07:08 ajinkyap12

exactly same error, please let me know if you have found the error

harshjain22 avatar Aug 19 '23 06:08 harshjain22

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

Quinn-Kiwalabye avatar Aug 21 '23 17:08 Quinn-Kiwalabye

Can u tell me what u have change or can u give us screenshot

ajinkyap12 avatar Aug 22 '23 08:08 ajinkyap12

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

I changed "openai": "^3.1.0" to this from version 4, but still I am getting the same error, I am stuck in this from weeks ,It would be a great help if you guide me to solve this issue my email : [email protected]

harshjain22 avatar Aug 22 '23 10:08 harshjain22

Can u tell me what u have change or can u give us screenshot

yes please, share some code files or Screenshots

harshjain22 avatar Aug 22 '23 10:08 harshjain22

@vatsal1812 share your code screenshot

please let me know what to do with the error. I've attached the screenshot of the error in another reply.

If you want the screenshot of the code, please let me know of which page or code file name you want the screenshot.

typeerror2 typeerror1

Have you solved this error ? if yes please share the solution, I am trying to debug it from weeks

harshjain22 avatar Aug 22 '23 10:08 harshjain22

Can u tell me what u have change or can u give us screenshot

step 1: go to the package.json file step 2: downgrade your open ai(make sure your package.json file matches adrian's file)`{ "name": "server", "version": "1.0.0", "type": "module", "description": "", "main": "index.js", "scripts": { "start": "nodemon index" }, "author": "", "license": "ISC", "dependencies": { "cloudinary": "^1.33.0", "cors": "^2.8.5", "dotenv": "^16.0.3", "express": "^4.18.2", "mongoose": "^6.8.2", "nodemon": "^2.0.20", "openai": "^3.1.0" }

}` step 3: stop your node server, by pressing ctrl c (windows) step 4: type "npm install", it will update the package json step 5: run the node server step 6: make sure that you have inported configuration, openAi from 'openai' dalle

Quinn-Kiwalabye avatar Aug 22 '23 10:08 Quinn-Kiwalabye

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

I changed "openai": "^3.1.0" to this from version 4, but still I am getting the same error, I am stuck in this from weeks ,It would be a great help if you guide me to solve this issue my email : [email protected]

can you send me a screen shot of what your inspection page is saying

Quinn-Kiwalabye avatar Aug 22 '23 10:08 Quinn-Kiwalabye

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

I changed "openai": "^3.1.0" to this from version 4, but still I am getting the same error, I am stuck in this from weeks ,It would be a great help if you guide me to solve this issue my email : [email protected]

can you send me a screen shot of what your inspection page is saying

I have made all the changes you suggested, now instead of typerror : failed to fetch I am getting this error :

image

harshjain22 avatar Aug 22 '23 10:08 harshjain22

pl

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

I changed "openai": "^3.1.0" to this from version 4, but still I am getting the same error, I am stuck in this from weeks ,It would be a great help if you guide me to solve this issue my email : [email protected]

can you send me a screen shot of what your inspection page is saying

I have made all the changes you suggested, now instead of typerror : failed to fetch I am getting this error :

image

please send your dalleRoutes code

Quinn-Kiwalabye avatar Aug 22 '23 10:08 Quinn-Kiwalabye

pl

exactly same error, please let me know if you have found the error i fixed this error by downgrading the openai to match adrian's version on package.json

I changed "openai": "^3.1.0" to this from version 4, but still I am getting the same error, I am stuck in this from weeks ,It would be a great help if you guide me to solve this issue my email : [email protected]

can you send me a screen shot of what your inspection page is saying

I have made all the changes you suggested, now instead of typerror : failed to fetch I am getting this error : image

please send your dalleRoutes code

import express from 'express'; import * as dotenv from 'dotenv'; import {Configuration, OpenAIApi} from 'openai';

dotenv.config();

const router = express.Router();

const configuration = new Configuration({ apiKey: process.env.OPENAI_API_KEY, }); const openai = new OpenAIApi(configuration);

router.route('/').get( (req, res) => { res.status(200).json({ message : 'Hello its DALL-E here'}); });

router.route('/').post(async (req, res) => { try { const { prompt } = req.body;

    const aiResponse = await openai.createImage({
        prompt, 
        n: 1,
        size: '1024x1024',
        response_format: 'b64_json'
    });

    const image = aiResponse.data.data[0].b64_json;

    res.status(200).json( { photo : image });

} catch (error) {
    console.error(error); 
    res.status(500).send(error?.response.data.error.message );

}

} );

export default router;

harshjain22 avatar Aug 22 '23 10:08 harshjain22

any update on this?

Raghu994 avatar Nov 26 '23 11:11 Raghu994

Same problem with me also,This solution can't work.

gaurav3590 avatar Dec 01 '23 05:12 gaurav3590

Screenshot 2023-12-01 103821 and also this error i can't solve plz some help me

gaurav3590 avatar Dec 01 '23 05:12 gaurav3590

can you share what errors are there in the inspect tab ?

harshjain22 avatar Dec 01 '23 11:12 harshjain22

257549787-53abb81f-e8d7-40e3-90a9-4f9d5356dfd8

gaurav3590 avatar Dec 01 '23 11:12 gaurav3590

Is any one get the solution of this problem, Failed to Fetch problem , please reply Uploading Screenshot (107).png…

jatinsharma2040 avatar Oct 18 '24 05:10 jatinsharma2040

Screenshot (107)

jatinsharma2040 avatar Oct 18 '24 05:10 jatinsharma2040