Error: "domain option is required" when deploying to Azure with Next.js app
Error: "domain option is required" when deploying to Azure with Next.js app
我在使用 Azure Web 应用程序将 Next.js 应用程序部署到 Azure 时遇到问题 我在部署我的应用程序时遇到 Auth0 错误,它抱怨问题需要一个域。
这是部署时我的 GitHub 操作的输出:
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'
}
我已经做过的事情
- 我将我的 .env 密钥添加到 Azure,称为“应用程序设置”
- 我已将 Github 操作从我的 Github 存储库配置到我在 Azure 中的 Web 应用程序
- 本地我有一个
.env
文件,我在其中定义了我的密钥
我的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: .
我在这里错过了什么?我会感谢你的帮助!
参考错误跟踪,这是一些配置问题,我们需要为我们的 webapp 设置域。查看有关如何在 Webapp 中设置自定义域的 documentation。
另外,根据评论的建议,我们可以在 GitHub 中设置默认环境变量,这些变量可用于工作流程中的每个步骤 运行。
Documentations 检查变量。
我在使用 Azure Web 应用程序将 Next.js 应用程序部署到 Azure 时遇到问题 我在部署我的应用程序时遇到 Auth0 错误,它抱怨问题需要一个域。
这是部署时我的 GitHub 操作的输出:
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'
}
我已经做过的事情
- 我将我的 .env 密钥添加到 Azure,称为“应用程序设置”
- 我已将 Github 操作从我的 Github 存储库配置到我在 Azure 中的 Web 应用程序
- 本地我有一个
.env
文件,我在其中定义了我的密钥
我的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: .
我在这里错过了什么?我会感谢你的帮助!
参考错误跟踪,这是一些配置问题,我们需要为我们的 webapp 设置域。查看有关如何在 Webapp 中设置自定义域的 documentation。
另外,根据评论的建议,我们可以在 GitHub 中设置默认环境变量,这些变量可用于工作流程中的每个步骤 运行。
Documentations 检查变量。