You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在Azure静态Web应用(SWA)的数据库预览中配置两张表?

问题:执行swa start后调用Data API Builder接口出错

相关文件及终端输出截图

  • staticwebapp.database.config.json 文件截图
  • swa start执行后的终端输出截图

问题详情

执行swa start命令后,调用本地地址的/data-api/rest/Courses接口时出现错误。此前修改主键时曾触发配置读取失败的提示,说明当前配置文件已被系统加载读取。

提供的Data API Builder配置文件

{  
  "$schema": "https://github.com/Azure/data-api-builder/releases/latest/download/dab.draft.schema.json",  
  "data-source": {    
    "database-type": "mssql",    
    "connection-string": "@env('DATABASE_CONNECTION_STRING')"  
  },  
  "runtime": {    
    "rest": {      
      "enabled": true,      
      "path": "/rest"    
    },    
    "graphql": {      
      "allow-introspection": true,      
      "enabled": true,      
      "path": "/graphql"    
    },    
    "host": {      
      "mode": "production",      
      "cors": {        
        "origins": [          
          "http://localhost:5173"        
        ],        
        "allow-credentials": true      
      },      
      "authentication": {        
        "provider": "StaticWebApps"      
      }    
    }  
  },  
  "entities": {    
    "Schedule": {      
      "source": "dbo.schedule",      
      "rest": {        
        "methods": ["get", "post", "put", "delete"],        
        "path": "/Schedule"      
      },      
      "permissions": [        
        {          
          "role": "anonymous",          
          "actions": ["read"]        
        }      
      ]    
    },     
    "Courses": {        
      "source": "dbo.courses",        
      "rest": {           
        "methods": ["get", "post", "put", "delete"],           
        "path": "/Courses"         
      },        
      "permissions": [         
        {           
          "role": "anonymous",           
          "actions": ["read"]         
        }        
      ]     
    }  
  }
}

内容的提问来源于stack exchange,提问作者vincent nguyen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 09:37:37