Issue with Custom Component

Hello all, I’m currently working on deploying an application using a custom component we’ve written to allow us to log in users w/Auth0. The application works well locally but when we deploy to stage or production the component seems to 404, resulting in this error:

After the page has been refreshed a few times (across all pods) the application works well, but of course this isn’t great from a user experience perspective.

Here’s the code we’re using to load the component:

        parent_dir = os.path.dirname(os.path.abspath(__file__))
        build_dir = os.path.join(parent_dir, "frontend/build")
        logger.info(
            "Login Button Component Directory",
            build_dir=build_dir,
            parent_dir=parent_dir
        )
        button = components.declare_component("login_button", path=build_dir)

I’ve confirmed that the build_dir is correct inside the pod itself.

Any help would be greatly appreciated!

Best,
Justin

Hi @Justin_Miller

Since the app is working with the component locally and is having issues when deployed on the cloud, perhaps the problem may lie in the dynamically generated file path.

Perhaps you can try to see if activating the static file path, would solve your issue?

# .streamlit/config.toml

[server]
enableStaticServing = true
1 Like

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