简体   繁体   English

错误:使用 Next.js 应用程序部署到 Azure 时出现“需要域选项”

[英]Error: "domain option is required" when deploying to Azure with Next.js app

I'm having an issue when deploying a Next.js app to Azure using Azure Web Apps I encounter an error with Auth0 when deploying my app, it complains issue with a Domain is required.我在使用Azure 将 Next.js 应用程序部署到 Azure 时遇到问题 Web 应用程序我在部署我的应用程序时遇到 Auth0 错误,它抱怨需要域的问题。

This is the output of my GitHub actions when deploying:这是部署时我的GitHub动作的output:

Using browser-only version of superagent in non-browser environment
(node:1647) UnhandledPromiseRejectionWarning: Error: domain option is required
    at attribute (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:45555)
    at Object.check (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:46043)
    at new WebAuth (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:128155)
    at Object.7531 (/home/runner/work/app-admin/app-admin/.next/server/chunks/680.js:28:15)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.3443 (/home/runner/work/app-admin/app-admin/.next/server/chunks/443.js:22:13)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.1836 (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:66:17)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:911:39)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1647) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1647) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1647) UnhandledPromiseRejectionWarning: Error: domain option is required
    at attribute (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:45555)
    at Object.check (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:46043)
    at new WebAuth (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:128155)
    at Object.7531 (/home/runner/work/app-admin/app-admin/.next/server/chunks/680.js:28:15)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.3443 (/home/runner/work/app-admin/app-admin/.next/server/chunks/443.js:22:13)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.1836 (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:66:17)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:911:39)
(node:1647) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

> Build error occurred
Error: domain option is required
    at attribute (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:45555)
    at Object.check (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:46043)
    at new WebAuth (/home/runner/work/app-admin/app-admin/node_modules/auth0-js/dist/auth0.min.js:8:128155)
    at Object.7531 (/home/runner/work/app-admin/app-admin/.next/server/chunks/680.js:28:15)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.3443 (/home/runner/work/app-admin/app-admin/.next/server/chunks/443.js:22:13)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at Object.1836 (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:66:17)
    at __webpack_require__ (/home/runner/work/app-admin/app-admin/.next/server/webpack-runtime.js:25:42)
    at __webpack_exec__ (/home/runner/work/app-admin/app-admin/.next/server/pages/_app.js:911:39) {
  type: 'Error'
}

Things I already done我已经做过的事情

  • I added my.env keys to Azure called "application settings"我将 my.env 密钥添加到 Azure,称为“应用程序设置”
  • I have the Github Actions configured from my Github Repo to my Web app in Azure我将 Github 操作从我的 Github Repo 配置到我的 Azure 中的 Web 应用程序
  • Locally I have a .env file where I defined my keys在本地我有一个.env文件,我在其中定义了我的密钥

My github action workflow.yml file我的github动作workflow.yml文件

 name: Build and deploy Node.js app to Azure Web App - app-admin
    on:
      push:
        branches:
          - develop
      workflow_dispatch:
 
   
jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2

      - name: Set up Node.js version
        uses: actions/setup-node@v1
        with:
          node-version: '14.x'

      - name: npm install, build, and test
        run: |
          npm install
          npm run build --if-present
          npm run test --if-present
      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v2
        with:
          name: node-app
          path: .

  deploy:
    runs-on: ubuntu-latest
    needs: build
    environment:
      name: 'Production'
      url: ${{ steps.deploy-to-webapp.outputs.webapp-url }}

    steps:
      - name: Download artifact from build job
        uses: actions/download-artifact@v2
        with:
          name: node-app

      - name: 'Deploy to Azure Web App'
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'app-admin'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_F1A195F9AA334F72B824DDFFC4053295 }}
          package: .

What am I missing here?我在这里错过了什么? I'll appreciate your help!我会感谢你的帮助!

Referring to the error trace this is some configuration issue where we need to set the domain for our webapp.参考错误跟踪,这是一些配置问题,我们需要为我们的 webapp 设置域。 Check for the documentation on how to setup a custom domain in Webapp.查看有关如何在 Webapp 中设置自定义域的文档

Also as suggested from the comment, we can set default environment variables in GitHub that are available to every step in a workflow run.同样根据评论建议,我们可以在 GitHub 中设置默认环境变量,这些变量可用于工作流运行中的每个步骤。

Documentations to check the variables.检查变量的文档

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 AWS Amplify 上部署 Next.js 时出错 - Error on deploying Next.js on AWS Amplify 使用 Github 操作将 Next.js 部署到 Azure 应用程序服务时出现问题 - Problem with Deploying Next.js to Azure App Service using Github Actions 尝试在 Next.JS web 应用程序中上传文本/图像时出现运行时错误 - I have a run time error when trying to upload text/image in Next.JS web app 在 AWS Amplify 上成功部署 8825558328788 应用程序后,https://www.example.com/api/any-route 在控制台中显示以下错误 - After successfully deploying Next.js app on AWS Amplify, https://www.example.com/api/any-route showing below error in console [错误]: {"code":"7","message":"No ssrResources.json file"} 部署 SSR Next Js App 时~AMPLIFY - [ERROR]: {"code":"7","message":"No ssrResources.json file"} when deploying a SSR Next Js App ~ AMPLIFY 如何将 Next.js 应用程序部署到 cPanel 上的插件域,它监听端口 3000 而不影响我的其他域? - How do I deploy a Next.js app to an addon domain on cPanel, which listens to port 3000 without affecting my other domains? Next.js 和 Firebase 在尝试读取一个文档时不断出现序列化错误 - Next.js and Firebase keep getting serialization error when trying to read one doc Next.js 应用程序在尝试实现谷歌 firebase 身份验证时崩溃 - Next.js app crashes when attempting to implement google firebase authentication 当 Firestore 已经在 Next.js 应用程序中运行时,它会不断尝试设置模拟器 - Firestore keeps trying to setup emulators when it's already running in Next.js app 使用 Next.js getStaticProps 重新验证时出现 AWS Amplify 503 错误 - AWS Amplify 503 error when using Next.js getStaticProps revalidate
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM