CMS Development

ACarr3
Member

Serverless function

Hello everyone, I'm writing a serverless function and I want to write a json file in the design manager using that serverless function. Right now I'm getting a permissions error so don't know if this is possible, if so has anyone dealt with this in the past?

0 Upvotes
2 Replies 2
vbrech
HubSpot Employee
HubSpot Employee

Serverless function

This should work, provided that your auth token belongs to a private app with the "content" scope. https://developers.hubspot.com/docs/api/cms/source-code (i.e. POST to https://api.hubapi.com/files/v3/files ). If this is what you were doing, what error are you seeing?

0 Upvotes
ACarr3
Member

Serverless function

Content scope is enabled, I'm no trying to use API. I just want to read/write a json file locally in the design manager. My serverless function contains a json variable, something like this: {"id":1,"value": "hello",...} and I want to put that variable into a json file in the design manager. I'm using fs and I'm getting this error:

 INFO error [Error: EROFS: read-only file system, open '/myfile.json'] {
errno: -30,
code: 'EROFS',
syscall: 'open',
path: '/resources.json'
}

0 Upvotes