wretry.action: Error: Cannot read property 'trim' of undefined
Hey!
Thanks for the action, it looks great. I’m trying to use it for a rather complicated use-case, and am getting the error
Error: Cannot read property 'trim' of undefined
Which comes from this line in your source code: https://github.com/Wandalen/wretry.action/blob/master/src/Common.js#L188:
function jobContextGet()
{
const context = Object.create( null );
if( dockerExists() )
{
const containersIds = execSyncNonThrowing( 'docker ps --all --filter status=running --no-trunc --format "{{.ID}}"' );
const ids = _.strSplit({ src : containersIds.toString(), delimeter : '\n', preservingEmpty : 0 });
context.container = Object.create( null );
context.services = Object.create( null );
for( let i = 0 ; i < ids.length ; i++ )
{
const output = execSyncNonThrowing( `docker inspect ${ ids[ i ].trim() }` ); // <---- error here
const parsed = JSON.parse( output.toString() );
if( !context.container.network )
context.container.network = parsed[ 0 ].HostConfig.NetworkMode;
const service = Object.create( null );
service.id = parsed[ 0 ].Id;
service.ports = Object.create( null );
for( let key in parsed[ 0 ].NetworkSettings.Ports )
if( parsed[ 0 ].NetworkSettings.Ports[ key ] !== null )
service.ports[ key.split( '/' )[ 0 ] ] = parsed[ 0 ].NetworkSettings.Ports[ key ][ 0 ].HostPort;
service.network = context.container.network;
context.services[ parsed[ 0 ].Args[ 0 ] ] = service;
}
}
But I’ve got no clue about what’s happening when it comes to docker containers, so unfortunately this is an issue and not a PR.
Here’s the commit where I modified the existing workflow to use your action: https://github.com/beyarkay/eskom-calendar-dev/commit/77bf6dcf4aca9aaf6994ed874cea47e7eddf6fdc
Here’s the lines in the github workflow files where I’m using your action: https://github.com/beyarkay/eskom-calendar-dev/blob/main/.github/workflows/publish-calendars.yaml#L59-L111
Here’s the run where I got the error: https://github.com/beyarkay/eskom-calendar-dev/actions/runs/3157204705/jobs/5137784537#step:10:56
I have a feeling that, because I’ve embedded a string inside the embeded string (see the body key and value in my action) that yaml might be getting confused? But this doesn’t really match with the error as far as I can see.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 23
@dominicmh I did not mean to commit real secret. I said ‘try a hardcoded value to check behavior’.
It’s good that the problem is solved.
@beyarkay, did this fix the issue for you? I noticed that accessing GitHub Actions secrets resulted in the mentioned
Error: Expects non-primitive:I’ve changed my workflow to use 1.0.28, but now I’m getting the error:
Error: Expects non-primitive.Any idea what’s causing this?
The PR #65 was merged. You can try to use new version.
I think it will be soon. I will report to the owner Wandalen that I opened PR with the fix.