Accessing a json file from node_modules in serverless.yml does not seem to work

variables
#1

I’m trying to access a json file located in node_modules. This value I’m using as a filter. During deploy I’m getting this message:
The CloudFormation template is invalid: [/Resources/SNSSubscriptionRegisterCollectionDevice/Type/FilterPolicy/type/0] ‘null’ values are not allowed in templates

I’ve made sure the file is there and I’ve tried to use a couple different paths but based on the example https://serverless.com/framework/docs/providers/aws/guide/variables/#reference-variables-in-other-files I should have the value correct.
SNSSubscriptionRegisterCollectionDevice:
Type: AWS::SNS::Subscription
Properties:
Protocol: lambda
TopicArn: {file(./env.yml):{opt:stage, self:provider.stage}.artifacts.auraTopicArn}
Endpoint: { “Fn::GetAtt” : [ “registerCollectionDeviceLambdaFunction”, “Arn” ]}
FilterPolicy:
type:
- ${file(./node_modules/aura_cloud_constants/messaging.json):types.PATIENT_REGISTER_COLLECTION_DEVICE_REQUEST}

Here is the messaging.json file
{
“types”: {
“COLLECTION_DEVICE_SETTINGS”: “COLLECTION_DEVICE_SETTINGS”,
“DEVICE_INFO”: “DEVICE_INFO”,
“DEVICE_RECORDING_CREATED”:“DEVICE_RECORDING_CREATED”,
“EEEG_PAGE” : “EEEG_PAGE”,
“PATIENT_REGISTER_COLLECTION_DEVICE_REQUEST”:“PATIENT_REGISTER_COLLECTION_DEVICE_REQUEST”,
“PATIENT_REGISTER_COLLECTION_DEVICE_COMPLETE”:“PATIENT_REGISTER_COLLECTION_DEVICE_COMPLETE”,
“PATIENT_REGISTER_COLLECTION_DEVICE_ERROR”:“PATIENT_REGISTER_COLLECTION_DEVICE_ERROR”,
“RECORDING_EVENT”: “RECORDING_EVENT”,
“RECORDING_COMPLETE” : “RECORDING_COMPLETE”,
“SERVER_MISSING_PAGES” : “SERVER_MISSING_PAGES”,
“SERVER_MISSING_PAGES_REQUEST” : “SERVER_MISSING_PAGES_REQUEST”,
“WRITE_PAGES_TO_FILE” : “WRITE_PAGES_TO_FILE”
},
“queues”:{
“COLLECTION_DEVICE_QUEUE_PREFIX” : “auraDevice”
},
“errors”:{
“PATIENT_INVALID_PRESCRIPTION”:“PATIENT_INVALID_PRESCRIPTION”
}
}

0 Likes

#2

@anwarhamr - I’m facing the same issue. Did you ever resolve this? Thanks!

0 Likes