Troubleshoot: Firebase deployment of Vue.js application unable to locate page

I'm currently working on a silly web app with my friends for some laughs. We're using Firebase hosting and Discord OAuth2. The issue arises when attempting to access the "/login" page either by entering it in the URL or clicking "authorize" on the Discord link. To see the problem firsthand, you can visit: (or check out the images below). Click the green button and then the blue one. This will lead you to a 404 default page. So, the "/login" page is only accessible if you click the initial green button and cannot be reached from any other route. I'm baffled as to why this is happening. This glitch doesn't occur when running the app locally (using npm run dev) - everything works as intended.

This is the landing page where you need to press the green button https://i.stack.imgur.com/kVBjd.jpg

Here's the "bugged" page, which is only accessible through the previous page https://i.stack.imgur.com/2l2Fu.png

If you attempt to directly access the page via the URL , you'll encounter a 404 error somehow.

Below are snippets of the code (let me know if more is needed):

Router:

import Vue from 'vue'
import Router from 'vue-router'
import homepage from '../views/HomePageView.vue'
import discordlogin from '../views/DiscordLoginView.vue'
Vue.use(Router)

export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'homepage',
      component: homepage
    },
    {
      name: "discordlogin",
      path: "/login",
      component: discordlogin
    }
    
    
  ]
})

Discord login page (the second page, which is currently unreachable):

<template>
  <div>
    <section class="vh-100 gradient-custom">
      <div class="container py-5 h-100">
        <div class="row d-flex justify-content-center align-items-center h-100">
          <div class="col-12 col-md-8 col-lg-6 col-xl-5">
            <div class="card bg-dark text-white" style="border-radius: 1rem;">
              <div class="card-body p-5 text-center">

                <div class="mb-md-5 mt-md-4 pb-5">

                  <h2 class="fw-bold mb-2 text-uppercase">Register with Discord</h2>
                  <p class="text-white-50 mb-5">You will be redirected to Discord</p>





                  <button @click="discordLink()" class="btn btn-outline-light btn-lg px-5" type="submit">Register <img
                      src="../assets/images/discord-ico.png"></button>

                  <div class="d-flex justify-content-center text-center mt-4 pt-1">
                    <a href="#!" class="text-white"><i class="fab fa-facebook-f fa-lg"></i></a>
                    <a href="#!" class="text-white"><i class="fab fa-twitter fa-lg mx-4 px-2"></i></a>
                    <a href="#!" class="text-white"><i class="fab fa-google fa-lg"></i></a>
                  </div>

                </div>

                <div>
                  <p class="mb-0">Having troubles? <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ"
                      class="text-white-50 fw-bold">I don't care! LMAO</a>
                  </p>
                </div>

              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>

...

To those who are lending a helping hand, thank you.

EDIT: While I removed mode: 'history' from the router configuration, the issue seems to have been resolved, although the behavior remains peculiar.

Answer №1

Upon clicking the green button, your browser initiates an HTTP POST Request to discord's oauth api.

https://i.stack.imgur.com/Deoss.png

This process is what is being displayed on the page.

The "/login" mentioned is not a real URL and is dynamically inserted through some Javascript magic in

/static/js/app.7ad2bbe6ea8f108e3c9a.js

https://i.stack.imgur.com/uZLOE.png

Furthermore, even if it did exist, access would only be permitted via POST requests (resulting in a 404 error for GET requests).

Answer №2

After removing the mode: 'history' setting from my router configuration, the problem was fixed. However, I'm uncertain if this is the best solution.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What steps can we take to create a personalized PDF editor incorporating our unique edit functionalities using Vue.js?

Is it possible to create a PDF editor similar to MS Word using vuejs? How can I implement custom logic in the PDF editor with vuejs? For example, the features should include: Conditional replacement of text Adding tags to text within the PDF Changing the ...

Building a Modular Socket.io System using Express 4

I'm currently working on modularizing my application files, and I've encountered a challenge with the integration of Socket.io. My goal is to utilize io within my routes.js file. Here's an example of what I'm attempting: var router = r ...

Add small pieces of content to CKEditor

Is there a way to add "atomic" block content into CKEditor? For instance, I would like to add <h1>Test</h1> right after the letter "B" in the sentence <p>A B C</p>. Currently, when using CKEDITOR.currentInstance.insertHtml('&l ...

Guide on implementing file download and saving to the downloads directory in a Vue.js and Laravel 5.4 application

I am looking to make a button called View Resume that, when clicked by the user, will download the resume and store it in the downloads folder. The resume is currently stored in my table and I would like to be able to use vue.js to facilitate the download ...

monitoring checkbox status in vue?

When using Vue, I have created dynamic checkboxes that display as shown below: <li v-for="element in checklist" :key="element.id" class="block w-full p-1"> <div v-if="element.taskId == task" clas ...

Nested JSON file retrieval by Axios

I am having trouble retrieving the 'title' from my JSON file. I have been trying to access it through the 'results - metaData' path, but so far without success. The 'resultPacket' is returning data, but accessing 'metaDat ...

Display one div and conceal all others

Currently, I am implementing a toggle effect using fadeIn and fadeOut methods upon clicking a button. The JavaScript function I have created for this purpose is as follows: function showHide(divId){ if (document.getElementById(divID).style.display == ...

Updating entire DOM in javascript

Implementing undo-redo functionality in my project has proven to be quite complex, as every change affects numerous elements. I believe that saving and restoring the entire page may be the most effective solution. However, I have encountered issues with mi ...

Display each new array element on a separate line

let team = [['Sara', 'John', 'Kate']] let newTeam = team.map(function(r) { return r; }) outputs [ [ 'Sara', 'John', 'Kate' ] ] Is there a way to modify it so that each value is r ...

Issue: ui-route failing to function properly when the href attribute is utilized

I am currently working on implementing ui-route to manage the states of my app while focusing on URL navigation. My goal is to enable users to simply click on a link and be directed to the state associated with the specific URL. After following an In-Dep ...

Having issues with ng-repeat not displaying any content

Let me describe the current situation I am facing: app.controller('ResourceController', function($scope, $sce){ var resourceData; $scope.data = ''; $scope.loadResources = function(){ $.get('con ...

Calculate the mean value of each array, and then determine which average is higher

After running the code snippet provided, I noticed that it outputs "first" instead of "second". Can you help me verify my logic here? I first calculate both averages and then compare them to return the greater one. Do you see any issues with this approac ...

Occasionally, the map may take a moment to fully load

Update: Resolving the issue involved directly calling these two methods on the map object: leafletData.getMap().then(function(map) { map.invalidateSize(); map._onResize(); }); Encountering a minor yet bothersome problem with the Leaflet directive ...

Substitute dynamic Angular expressions with fixed values within a string

Inside my angular controller, I am defining a stringTemplate containing expressions like "{{data.a}} - {{data.b}}". Along with that, I have an object named data with values {a: "example1", b: "example2"}. My goal is to find a way to replace the dynamic ex ...

Sending a POST request results in both the execution of the THEN and CATCH

I am encountering a strange issue with my submit function, which is used to save an article. Despite receiving a success response code of 200 in the browser, both the 'then' success branch and the 'catch' error branch are triggered simu ...

Tips for avoiding the influence of the parent div's opacity on child divs within a Primeng Carousel

I'm struggling to find a solution to stop the "opacity" effect of the parent container from affecting the child containers. In my code, I want the opacity not to impact the buttons within the elements. I have tried using "radial-gradient" for multipl ...

Utilizing JQuery and Jade to extract and display information from a Node.js server

I am currently working with the Jade framework for frontend and using Node.js & express for backend development. When rendering a view with data, I am encountering an issue where I can't access this data using JQuery. Below is my service in Node.js ...

What could be causing my JavaScript alert to not appear on the screen?

Essentially, I've been attempting to trigger a Javascript alert using PHP. However, the alert isn't functioning at all. This is my echo statement that dynamically generates the alert echo "<script>alert('Uploaded file was not in the ...

Unable to use model.find() in post findOneAndUpdate hook for Mongoose

Introduction In Mongoose, I am facing an issue with a post findOneAndUpdate hook where I need to perform a database query. Specifically, when trying to execute a .find() operation on another model, I encounter the following error: Error Description Typ ...

Creating a custom navigation bar that elegantly fades away with a smooth animation as you scroll down the page is a must-have

How can I create a navigation bar that disappears when scrolling, with a smooth animation? This is the progress I have made so far. HTML: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/style.css" type="tex ...