question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't pass number from template to custom action step

See original GitHub issue

Expected Behavior

Using the number type for a custom action’s input should work.

Current Behavior

It appears there is no way to pass a number type from a custom template to a custom action step.

The following error occurs:

InputError: Invalid input passed to action uip:argocd-deploy, instance.port is not of a type(s) number

Possible Solution

¯\_(ツ)_/¯

Steps to Reproduce

  1. In the template, define a property like so:
port:
  title: Port
  type: integer
  default: 8080
  1. Pass that property to an action
- id: custom-action
  name: Custom Action Name
    action: custom:action
    input:
      port: '{{ json parameters.port }}' # I have also tried '{{ parameters.port }}' with and without quotes
  1. In the action define the input property with the number type:
{
  id: 'custom:action',
  schema: {
    input: {
      type: 'object',
      properties: {
        port: {
          type: 'number',
          title: 'Port',
          description: 'The port the service runs on.'
        }
      }
    }
  }
}

4. Try to use the template and see the error.

Context

I can workaround this by using the string type and using Number.parseInt() so this isn’t a blocker.

Your Environment

N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mtlewiscommented, Sep 9, 2021

Thanks for reporting @ConnorDY! I think I can see the cause: there are some special cases in the scaffolder which mean it’s possible to work with complex template inputs like lists and arrays. It should be possible to extend this conditional to catch numeric strings too - we should be able to run them through JSON.parse and get the right result.

FWIW this is something we’re looking to improve - this RFC contains some details if you’re interested.

0reactions
frebencommented, Nov 22, 2021

Alright, let’s close this for now and presume that it has been fixed in the new template format. Do feel free to reopen if this is not the case!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass parameters to the custom action? - Stack Overflow
However, I get an error stating that DLLENtry and Value cannot coexist. But the custom action without dllentry is invalid. This is the...
Read more >
Create and add a custom action in CodePipeline
Describes how to create a custom action for use in a pipeline or all of your pipelines by using the console or the...
Read more >
Few questions about custom actions – Crow Canyon Software Forum
No matter what I try I cannot get the custom action to appear on the edit ... To remove duplicate actions from display...
Read more >
Configure custom process actions from a workflow - Power Apps
Go to Settings > Solutions and locate the unmanaged solution that this action will be part of. Then, in the menu bar, select...
Read more >
Dynamics 365 Custom Actions - It Ain't Boring
A custom action has to be triggered either as a workflow step or from the web ... We can't pass parameters to /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found