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

Having trouble transferring data from Flask to JavaScript as JSON when using a separate .js file

In my templates/index.html file, I have the following code: <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style> </style> </head> & ...

Is employing setTimeout a legitimate technique for circumventing a stack overflow issue when implementing callbacks?

Let's imagine a scenario where I deliberately create a complex sequence of callbacks: function handleInput(callback) { ... } function fetchData(url, callback) { ... } function processResponse(callback) { .... } function updateDatabase ...

Utilizing the components within the range set by paper.setStart() and paper.setFinish() in Raphaels

My question has two parts - the first and second part. Let's consider an example code that I am working on. I am creating a map of my country with regions, and I want to perform actions on the entire map such as scaling or translating (as seen in the ...

Unintentional GET request triggered by Axios baseURL

I have encountered a strange issue where defining axios.defaults.baseURL = baseUrl; results in an unexpected GET request right after initializing my Vue app. Any assistance would be greatly appreciated! Below are images showing the code and network reques ...

Customizing the JavaScript code created by the "Change Variable by..." block in Blockly

I'm currently working on a Blockly Project where I am passing data from the blocks as JavaScript code. One of my goals is to make some adjustments to the output code in order to make it more user-friendly for beginners. While it is possible to modify ...

The function cannot be applied to the size of the map within the action payload

Is there a way to replace the for loop with the map method? The data structure for book.pages is in the format [{},{},{}] I tried using the size method and included this line console.log("book.pages.map.size();--->", book.pages.map.si ...

Exploring the Power of Map with Angular 6 HttpClient

My goal is to enhance my learning by fetching data from a mock JSON API and adding "hey" to all titles before returning an Observable. Currently, I am able to display the data without any issues if I don't use the Map operator. However, when I do use ...

Are there any comprehensive guides on AngularFire authentication and authorization techniques available?

If you're looking for help with AngularFire authentication, there are several useful resources to explore. For beginners, a good starting point is Basic user authentication with records in AngularFire. You may also find Anant Narayanan's presen ...

What is the process for retrieving DOM elements and JavaScript variables using PHP?

I am currently developing a PHP script that will dynamically generate tables in MySQL based on the user's input for the number of columns and column names. However, I have encountered some challenges when trying to access DOM elements and JavaScript v ...

Embed the aspx file within the background-image attribute similar to how an image source is

Within my asp.net application, there is an image tag linking to another aspx file in the src attribute, displaying a picture. <img src="/picture.aspx?Param=3" alt="picture"/> I need to convert the image tag into a div with a background-image proper ...

Strategies for delaying the loading of CSS when importing

import 'react-dates/lib/css/_datepicker.css' The CSS mentioned can be deferred since it is not critical. Is it possible to defer the loading of CSS when utilizing import? I found information on deferring CSS loading using <link> from Goo ...

$http promise chain executing in an incorrect sequence

As a beginner in angularjs, my objective is straightforward. I aim to execute an ajax request to fetch data and, upon completion, I want to initiate a second call to retrieve another set of data based on the information from the initial set. To achieve th ...

Is there a way to prevent mouse wheel scrolling on a React "number" input field?

Currently, I am encountering an issue with MUI type="number" textfields. When I focus on the field and then scroll the mousewheel, the input value changes unexpectedly. I have looked into adding a blur function after scrolling to prevent this, but I would ...

What is the best way to integrate Vue with Django?

I'm currently working on integrating a reactive Vue.js frontend with Django backend for my project. However, I am struggling to understand how to effectively combine these two technologies. While I have come across various methods to achieve this inte ...

Master the art of returning two functions within a single function in Javascript with NodeJS and ExpressJS

Currently, I am facing an issue where I need to combine two objects and return them in one function. The challenge lies in the fact that both objects have almost identical properties, but different values. To tackle this problem, I created two separate fu ...

When the application is converted into static files, the dynamic routes fail to function properly

I have a website that is statically exported but has dynamic routes. During development, the site works fine. However, when I build and export it, then serve the static files using serve, an issue arises. If you go to the site root and click on a link th ...

By utilizing the power of JSONP, data transfer limitations can be eliminated

Is it possible to remove the limitation on data sent using JSONP? Here's my code. I'm attempting to send 3000 characters (an image converted to base64 data) at a time to a service (serviceCall.ashx). Since my data is quite large, up to 30,000-40, ...

Creating a design utilizing HTML columns with a set height and the ability to scroll horizontally

For my android project, I have a requirement to display a view (WebView) that dynamically loads content. The content will consist of <div class="content-item"> tags that are added by JavaScript to <div class="content-holder"> after the page has ...

How can you select a variable using Jquery?

$.get('sampleurl.com',function(result){ target = $(result #specificID).attr("href") // Can someone help me with this??? }) I fetch content from an external website using $.get and store it in the result variable, now I'm trying to figure ou ...

What criteria does a PHP function need to meet in order to be considered valid for use with AJAX and PHP?

My website includes an input field that undergoes real-time checking via AJAX requests to inform users if their input is valid or not. Upon submission, the input must be rechecked to ensure it meets the same criteria as checked by AJAX (in case JavaScript ...