ValueError Exception Value: The view ipfs.views.upload_img didn't return an HttpResponse object. It returned None instead

i have issue in project Web3 Crowd Funding | Upgradeable Smart Contracts | React & Python | Moralis Blueprint.
The view ipfs.views.upload_img didn’t return an HttpResponse object. It returned None instead.
find attached ss.


ValueError at /upload_img/ The view ipfs.views.upload_img didn’t return an HttpResponse object. It returned None instead. Request Method: GET Request URL: http://127.0.0.1:8000/upload_img/ Django Version: 4.2.1 Exception Type: ValueError Exception Value: The view ipfs.views.upload_img didn’t return an HttpResponse object. It returned None instead.

Hey @ram_gawas,

can you show how does your code looks like in ipfs.views.upload_img?

Hey @ram_gawas,

Can you try to add try-except to debug further on what is the specific error that is causing the whole code to fail?

Also can you show what you defined in upload_img_to_ipfs and copy the code this time instead of giving the image?

Thanks!

from moralis import evm_api

from dotenv import load_dotenv

import os

load_dotenv()

api_key = os.getenv(“MORALIS_API_KEY”)

def upload_img_to_ipfs(path, image):

body = [

    {

        "path": path,

        "content": image,

    }

]

result = evm_api.ipfs.upload_folder(

    api_key=api_key,

    body=body,

)

return result

Hi @ram_gawas

Can you try logging the result data to check what is returned?

As mentioned on the previous post can you share what type of image data are you trying to upload? The image data should be in base64 format. Unsupported format will cause error from the API endpoint.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.