Skip to content

[Bug] Unable to connect to Fabric SQL Database #213

@hbezuidenhout

Description

@hbezuidenhout

Describe the bug

PAC CLI generates Fabric SQL Database Service, but when service is called a 404 is returned. The SQL Server Connector being used is working in normal Canvas Apps.

Steps to Reproduce

  1. Generate Code with PAC CLI:
    pac code add-data-source -a "shared_sql" -c "connection_id" -d "somestuff.database.fabric.microsoft.com,apps_some" -t "[dbo].[PC_Hierarchy]"

Generated dataSourceInformation

  "gl_hierarchy": {
    "tableId": "GL_Hierarchy",
    "version": "v2",
    "primaryKey": "",
    "dataSourceType": "Connector",
    "apis": {}
  },
  "pc_hierarchy": {
    "tableId": "PC_Hierarchy",
    "version": "v2",
    "primaryKey": "",
    "dataSourceType": "Connector",
    "apis": {}
  }

All the types etc.. were correctly generated so I'm guessing the PAC CLI generated everything successfully

  1. Use the generate service code:
const getGLs = () =>
    PC_HierarchyService.getAll()
      .then((result) => {
        console.log("Result", result);
      })
      .catch((error) => {
        console.error("Error", error);
      });
  1. See error Log:
58d17b10-9776-4e54-ad9d-645be7e5c733.02.common.europe002.azure-apihub.net/invoke:1  Failed to load resource: the server responded with a status of 404 ()
Result Object
data: undefined
error: {message: '{ "statusCode": 404, "message": "Resource not found" }', 
status: 404, 
requestId: '489aaa1e-9d7b-4c70-a357-89d075df248a'}
success: false[[Prototype]]: Object

Header, the connecter being used is correct and works in normal canvas apps

:authority: 58d17b10-9776-4e54-ad9d-645be7e5c733.02.common.europe002.azure-apihub.net
:method: POST
:path: /invoke
:scheme: https
accept: application/json
accept-encoding: gzip, deflate, br, zstd
accept-language: en-US
authorization: Bearer [REDACTED]
cache-control: no-cache, no-store
content-length: 71
content-type: application/json
origin: https://apps.powerapps.com
priority: u=1, i
referer: https://apps.powerapps.com/
sec-ch-ua: "Not:A-Brand";v="99", "Google Chrome";v="145", "Chromium";v="145"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-dest: empty
sec-fetch-mode: cors
sec-fetch-site: cross-site
user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
x-ms-client-app-id: /providers/Microsoft.PowerApps/apps/local
x-ms-client-environment-id: /providers/Microsoft.PowerApps/environments/something
x-ms-client-object-id: something
x-ms-client-request-id: something
x-ms-client-session-id: something
x-ms-client-tenant-id: something
x-ms-enable-selects: true
x-ms-protocol-semantics: cdp
x-ms-request-method: GET
x-ms-request-url: /apim/sql/2c51aa8197964e79abe8a3ac010f310c/tables/PC_Hierarchy/items
x-ms-user-agent: PowerApps/3.26021.10 (Web Player; AppName=local)

Environment information

Windows 11,
Power platform Tools version: 2.0.131

{
  "name": "vite",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "tsc -b && vite build",
    "lint": "eslint .",
    "preview": "vite preview"
  },
  "dependencies": {
    "@base-ui/react": "^1.2.0",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "lucide-react": "^0.575.0",
    "radix-ui": "^1.4.3",
    "react": "^19.2.0",
    "react-dom": "^19.2.0",
    "recharts": "^2.15.4",
    "sonner": "^2.0.7",
    "tailwind-merge": "^3.5.0",
    "tailwindcss": "^4.2.0",
    "vaul": "^1.1.2"
  },
  "devDependencies": {
    "@eslint/js": "^9.39.1",
    "@microsoft/power-apps-vite": "^1.0.2",
    "@types/node": "^24.10.13",
    "@types/react": "^19.2.5",
    "@types/react-dom": "^19.2.3",
    "@vitejs/plugin-react": "^5.1.1",
    "eslint": "^9.39.1",
    "eslint-plugin-react-hooks": "^7.0.1",
    "eslint-plugin-react-refresh": "^0.4.24",
    "globals": "^16.5.0",
    "shadcn": "^3.8.5",
    "tw-animate-css": "^1.4.0",
    "typescript": "~5.9.3",
    "typescript-eslint": "^8.46.4",
    "vite": "^7.2.4"
  }
}
  • Any connection/components: SQL Sevrer Connection (logged in with microsoft entra id)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions