Я пытаюсь использовать Serverless для компиляции фоновых файлов.«...», похоже, вызывает ошибку, но я не понимаю, почему.
ОШИБКА в ./handler.js Ошибка сборки модуля: SyntaxError: '' /handler.js: неожиданный токен(27: 6)
const customContext = {... context, ^ user: {id, type: isGuest?USER_TYPE.GUEST: USER_TYPE.USER,
Below is the full code in handler.js file
// console.log('graphql - event:', JSON.stringify(event));
if (event.source === 'aws.events') {
return callback(null, createResponse(200, ''));
}
const {body, requestContext = {}, headers } = event;
const bodyObj = JSON.parse(body);
/* BEGIN: build custom context from event object */
const identity = requestContext.identity;
if (!identity) {
// noinspection ExceptionCaughtLocallyJS
throw new Error('---- Missing identity in requestContext');
}
const isGuest = (identity.cognitoAuthenticationType == 'unauthenticated');
const id = isGuest ? identity.cognitoAuthenticationType : getIdHelper(requestContext);
const customContext = {
...context,
user: {
id, type: isGuest ? USER_TYPE.GUEST : USER_TYPE.USER,
},
identity,
headers
};