Unable to create service and trigger but application is created and error occures 404 not found

exports.createService = async (client, serviceName, clusterName) => {
try {
const response = await client.service.create({
‘name’: serviceName, // this can be anything
‘type’: ‘mongodb-atlas’,
‘config’: {
‘clusterName’: clusterName
}
});
console.log(response._id);
return response._id;
} catch (e) {
console.log('createService → error → ', e);
throw new Error(e);
}
}

this function call from index.js

if(serviceId === ‘’){
console.log('Creating Service ’ + serviceName + ‘…’);
serviceId = await createService(client, serviceName, clusterName);
console.log('Created Service - ', serviceId);
}

const client = getMongodbRealmApiClient({
‘publicKey’: publicKey,
‘privateKey’: privateKey,
‘baseUrl’: ‘https://stitch.mongodb.com/api/admin/v3.0’,
‘appId’: appId, // Optional for first run when you are creating an app.
‘projectId’: projectId // You can get this from mongodb console url by selecting project.
});

This topic was automatically closed after 180 days. New replies are no longer allowed.