【问题标题】:Gh-pages deployment starts to render, but errors 404gh-pages 部署开始渲染,但错误 404
【发布时间】:2021-09-26 16:02:26
【问题描述】:

我已经在本地测试了我的 React pwa,并且对结果很满意,但是,当我部署到 gh-pages 时,我收到了 404 错误。有趣的是,我的网站在转到未找到的 404 页面之前开始呈现。我很茫然,因为我读过的大部分内容都说这个问题是由于没有 index.html 文件,而这里不是这种情况。任何帮助将不胜感激。

https://evandersloot.github.io/meet-app/

【问题讨论】:

    标签: reactjs progressive-web-apps github-pages


    【解决方案1】:

    我认为问题出在api.js 第 68 行

    const results = await axios.get('https://dx9dq6q3th.execute-api.us-east-1.amazonaws.com/dev/api/get-auth-url');
    const { authURL } = results.data;
    return (window.location.href = authURL);
    

    authURL 似乎是undefined。因此,当它设置window.location.href = undefined 时,它会请求https://evandersloot.github.io/meet-app/undefined,然后github 返回一个404 页面。

    【讨论】:

    • 谢谢!一旦我发现错误并定义了 authUrl,页面就会按原样呈现。
    猜你喜欢
    • 2013-07-18
    • 2022-01-23
    • 1970-01-01
    • 2021-11-08
    • 2018-12-09
    • 1970-01-01
    • 1970-01-01
    • 2022-01-20
    • 2017-08-20
    相关资源
    最近更新 更多