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

eggplantSword's avatar

TypeError: Cannot read property 'status' of undefined on Get

I'm getting the weird error and I don't know why. I'm just doing a get request, I'm doing another one in the same file without any issues. I'm using Inertia.js and Vue.js

This is the code

 downloadExcel() {
    this.$inertia.replace('/result/filter/questions', {
        method: 'get', data: {
            questions: this.survey_question
        }
     })
},

Where I'm calling it

 <el-button :disabled="export_disabled" type="warning" @click="downloadExcel">Download</el-button>

My Route

Route::get('result/filter/questions', 'ResultController@downloadExcel');

And the controller method

 public function downloadExcel(Request $request)
{
    return dd($request->all());
}

I'm super confused on why this is happening as it's never happened to me before in any project. How can I fix it?

0 likes
10 replies
bobbybouwmann's avatar

It's because you do dd($request->all()). That is now being converted to HTML and returned. You can do that in an ajax call because inertia won't understand how to handle the generated HTML for the dump.

Instead of dumping it in Laravel, you can for example console.log the data in your javascript or write the content you want to dump to your log file Log::info('content')

eggplantSword's avatar

@bobbybouwmann I'm just trying to see if the data is correct, even if I do a dd('here') without a return it still gives me the same error.

bobbybouwmann's avatar

@msslgomez Correct, because the dd method generates a response in HTML. You're trying to debug the server (Laravel) now in your frontend.

You can see the value of the dd in your developer console in the browser, in the network tab. All ajax requests are available in there as well.

tykus's avatar

@msslgomez if you install (as a dev dependency) and run the Laravel Dump Server, you can dump and dd your application state without affecting the response; this is especially useful for API development IMHO.

eggplantSword's avatar

@bobbybouwmann The weird thing is I always do it this way to make sure the route and controller are working correctly and this has never happened before, I can't do more testing right now but I'll try that later and report back!

bobbybouwmann's avatar

@tykus Yeah, a very good addition to this thread ;)

@msslgomez This happens because your frontend expects JSON as a response, but you return the whole dumped object converted to HTML.

eggplantSword's avatar

@bobbybouwmann I tried doing a Log::info('here'); and even a return back()->with('info', 'in controller'); and nothing makes a difference with the error, it always gives me the error every time. What else can I try?

eggplantSword's avatar

@bobbybouwmann I did some searching online and someone suggested adding this to the request, this seems to remove the error and now the console.log(res) however this returns the same message but now not as an error. And it points to the console.log(res) line.

this.$inertia.replace('/filter/questions', {
                    method: 'get', data: {
                        question: this.survey_question
                    }
                }).then(
                    () => {
                       console.log('success')
                    },
                    (res) => {
                        console.log(res)
                    });

Please or to participate in this conversation.