I\'ve got a bit of javascript which runs on my local machine but doesn\'t work from within the Lambda.
It timeouts when calling cognitoidentity.getOpenIdTokenF
it must be the policy I have attached
No, if that were the case you would be getting a permission denied error, not a timeout.
It looks like your Lambda function has VPC access. You need to configure a NAT gateway for your VPC in order for the Lambda function to have access to anything outside the VPC, including AWS services like Cognito.