Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Spiral's avatar

Call to undefined function getUser() after deploy on heroku serve

helpers function not working on heroku server after deploy

0 likes
8 replies
jlrdw's avatar

Did you do a dumpautoload?

Did you check letter case?

Helpers verses helpers is case sensitive on linux.

1 like
Spiral's avatar

Yes Bro... did this

i'm using window OS

Spiral's avatar

i have registered helpers.php in composer.json

"autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        },
        "files": [
            "app/Helpers/helpers.php"
        ]
    },
jlrdw's avatar

Have you tried using the browser developer tools to see what's going on with response and request. And I am guessing from the question it works in local development, but not in production. Perhaps show the method.

1 like
Talinon's avatar
Talinon
Best Answer
Level 51

@spiral You have the helper defined under autoload-dev, so of course it won't work on production.

2 likes
Spiral's avatar

@jlrdw getting internal server error 500 in the devtool

sheltered-refuge-25738.herokuapp.com/:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Spiral's avatar

Thanks @talinon brother when used

"autoload-dev": {
        "psr-4": {
            "Tests\": "tests/"
        },
        "files": [
            "app/Helpers/helpers.php"
        ]
    },

to

"autoload": {
        "psr-4": {
            "App\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "files": [
            "app/Helpers/helpers.php"
        ]
    },

then working find thanks again bro

jlrdw's avatar

@spiral glad you got it, that was a good catch on the autoload-dev.

2 likes

Please or to participate in this conversation.