Skip to content

Conversation

@dido18
Copy link
Contributor

@dido18 dido18 commented Nov 12, 2025

Motivation

Close #68

When a brick with required variables is added to an app created from scratch the operation fails.

This is because the FE (appLab) does not pass the required variables when the PUT /v1/apps/{appID}/bricks/{brickID} is called.

For example, the brick arduino:arduino_cloud has the ARDUINO_DEVICE_ID and ARDUINO_SECRET required.
When it is added to a scratch app, it fails silently.

Additionally, the issue does not occur when an app with a brick already added is cloned.
This is because when an app is cloned the code does not check the required variable.

Change description

The following changes are

  • When a brick is added to an app: DO NOT raise an error by logging a Warning and putting the required variable as an empty string.
  • When an app is started or restarted, a validation of the bricks of the app.yaml is performed. An app.yaml is invalid in the following cases:
    1. A required variable is omitted
    2. A required variable among two is omitted
    3. A variable does not exist into the brick definition
    4. A brickID not found in the bricks index

Example:
Given the following app-yaml, where the required ARDUINO_SECRET variable of arduino:arduino_cloud is missing:

name: hello
description: ""
ports: []
bricks:
- arduino:arduino_cloud: 
  variables:
      ARDUINO_DEVICE_ID: ""
icon: 😀

When an app is started

  • from arduino-app-cli
$ arduino-app-cli app start user:ciao
[ERROR] Variable "Arduino_secret" Is Required By Brick "Arduino:arduino_cloud"
  • from the FE:
variable "ARDUINO_SECRET" is required by brick "arduino:arduino_cloud" variable "ARDUINO_DEVICE_ID" is required by brick "arduino:arduino_cloud"

When an app is restarted

arduino@merola:/$ arduino-app-cli app restart user:ciao
[ERROR] Variable "Arduino_device_id" Is Required By Brick "Arduino:arduino_cloud"
Variable "Arduino_secret" Is Required By Brick "Arduino:arduino_cloud"
arduino@merola:/$

Additional Notes

Reviewer checklist

  • PR addresses a single concern.
  • PR title and description are properly filled.
  • Changes will be merged in main.
  • Changes are covered by tests.
  • Logging is meaningful in case of troubleshooting.

@dido18 dido18 changed the title fix(api): add brick allow empry required variable fix(api): allow empty required variable when a brick id added Nov 12, 2025
@dido18 dido18 changed the title fix(api): allow empty required variable when a brick id added fix(api): allow empty required variable when a brick is added Nov 12, 2025
@dido18 dido18 changed the title fix(api): allow empty required variable when a brick is added fix(api): allow missing required variable when a brick is added Nov 12, 2025
@dido18 dido18 marked this pull request as ready for review November 12, 2025 17:24
@per1234 per1234 added the bug Something isn't working label Nov 12, 2025
@dido18 dido18 requested a review from a team November 14, 2025 16:14
@dido18 dido18 changed the title fix(api): allow missing required variable when a brick is added fix(api): allow missing required variable when a brick is added + app validation Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: it is not possible to add the Arduino Cloud brick into a newly created app

2 participants