Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed API Function not recognized when building manually #1602

Open
peterlugt opened this issue Jan 13, 2025 · 0 comments
Open

Managed API Function not recognized when building manually #1602

peterlugt opened this issue Jan 13, 2025 · 0 comments

Comments

@peterlugt
Copy link

Because of the permission issue when using the API build in the AzureStaticWebApp@0 task, I am skipping the API build and build it in an earlier task.

Here is my task:

- task: AzureStaticWebApp@0
    inputs:
      app_location: "/dist"
      output_location: ""
      skip_app_build: true
      api_location: "/src/api/dist"
      skip_api_build: true
      verbose: true
      azure_static_web_apps_api_token: "$(DeploymentToken)"

The build for the app works fine, but my api (Managed Function, node:18) is not recognized in the portal. It's not showing up. The build task for my Function looks like this:

  - task: Npm@1
    displayName: "Build command Api (function): npm --prefix api build --production"
    inputs:
      command: custom
      verbose: false
      customCommand: "run --prefix src/api build --production"

My dist folder, in the pipeline looks like this:

2025-01-13T15:46:12.7797380Z ├── src
2025-01-13T15:46:12.7797647Z │   ├── api
2025-01-13T15:46:12.7797785Z │   │   ├── dist
2025-01-13T15:46:12.7797937Z │   │   │   ├── functions
2025-01-13T15:46:12.7798106Z │   │   │   │   └── HealthCheck.js
2025-01-13T15:46:12.7798260Z │   │   │   ├── host.json
2025-01-13T15:46:12.7798407Z │   │   │   ├── index.js
2025-01-13T15:46:12.7798558Z │   │   │   └── package.json

Am I missing any files in the output folder? I think the package.json shouldn't be there but I added it, since it has some information about the 'main' method.

I added the following code to my staticwebappconfig.json, to set the language:

  "platform": {
    "apiRuntime": "node:18"
  }

That part is picked up correctly by the pipeline. Locally the function works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant