Viv*_*vek 2 azure stripe-payments azure-web-app-service azure-devops
经过大量研究,关注 YouTube 视频https://youtu.be/Ny5vJRfQito并将支付网关部署到 Azure。
但是,在付款时,遇到以下问题,说明没有找到 payment_intent.js
以下是存储库中可用文件的屏幕截图
借助URL https://myapp.scm.azurewebsites.net/DebugConsole/?shell=powershell导航到Azure App Service,发现文件不在列表中,如下图
谷歌搜索了很多,但找不到解决方案。
如果这里有人可以帮助我在 Azure 上进行部署以及需要采取哪些其他步骤来解决问题,我将不胜感激。
如果需要任何其他详细信息,请告诉我
提前致谢
更新
这是一个 Next.js 应用程序,最终的项目文件存储在OUT文件夹中,因为 next.js 没有构建文件夹,如下所示。同样的文件也显示在 www 根目录下。
代码在 localhost 上运行良好,以下是完整的文件夹结构
下面是构建管道的屏幕截图
下面是out文件夹
我使用您的代码重现了 404 错误,并注意到您使用了 next.js 项目,这在 Azure 中与本地略有不同。
您需要两个文件:server.js和web.config,并按package.json如下方式修改。我用你的代码进行了测试,它在我这边工作得很好。
package.json修改。
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "node server.js"
Run Code Online (Sandbox Code Playgroud)
server.js(使用以下代码创建此文件:)
const { createServer } = require('http')
const next = require('next')
const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()
app.prepare().then(() => {
createServer((req, res) => {
const parsedUrl = new URL(req.url, 'http://w.w')
const { pathname, query } = parsedUrl
if (pathname === '/a') {
app.render(req, res, '/a', query)
} else if (pathname === '/b') {
app.render(req, res, '/b', query)
} else {
handle(req, res, parsedUrl)
}
}).listen(port, (err) => {
if (err) throw err
console.log(`> Ready on http://localhost:${port}`)
})
})
Run Code Online (Sandbox Code Playgroud)
web.config(使用以下代码创建此文件:)
<?xml version="1.0" encoding="utf-8"?>
<!--
This configuration file is required if iisnode is used to run node processes behind
IIS or IIS Express. For more information, visit:
https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config
-->
<configuration>
<system.webServer>
<!-- Visit http://blogs.msdn.com/b/windowsazure/archive/2013/11/14/introduction-to-websockets-on-windows-azure-web-sites.aspx for more information on WebSocket support -->
<webSocket enabled="false" />
<handlers>
<!-- Indicates that the server.js file is a node.js site to be handled by the iisnode module -->
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Do not interfere with requests for node-inspector debugging -->
<rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^server.js\/debug[\/]?" />
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}"/>
</rule>
<!-- All other URLs are mapped to the node.js site entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/>
</conditions>
<action type="Rewrite" url="server.js"/>
</rule>
</rules>
</rewrite>
<!-- 'bin' directory has no special meaning in node.js and apps can be placed in it -->
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin"/>
</hiddenSegments>
</requestFiltering>
</security>
<!-- Make sure error responses are left untouched -->
<httpErrors existingResponse="PassThrough" />
<!--
You can control how Node is hosted within IIS using the following options:
* watchedFiles: semi-colon separated list of files that will be watched for changes to restart the server
* node_env: will be propagated to node as NODE_ENV environment variable
* debuggingEnabled - controls whether the built-in debugger is enabled
See https://github.com/tjanczuk/iisnode/blob/master/src/samples/configuration/web.config for a full list of options
-->
<!--<iisnode watchedFiles="web.config;*.js"/>-->
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
上一篇:添加web.config和server.js和修改package.json。
1. 创建构建管道。
2. 创建发布管道。
3. 运行构建-->触发发布。
下载并检查工件:
| 归档时间: |
|
| 查看次数: |
1395 次 |
| 最近记录: |