Skip to content

SyntaxError: The requested module '@aws-amplify/platform-core' does not provide an export named 'CallerDirectoryExtractor' #2039

@jitinrathi910949

Description

@jitinrathi910949

I created a lambda function using gen2 as follow:

amplify/functions/send-link-file/resource.ts file:

`import { defineFunction } from '@aws-amplify/backend';

export const sendReportEmail = defineFunction({
  name: 'send-report-email',
  entry: './handler.ts',
  timeoutSeconds: 180
});`

hander.ts file:


import {SendRawEmailCommand, SESClient, } from '@aws-sdk/client-ses';
import { CreateForm1 } from './pdf';

const sesClient = new SESClient({region: 'ap-south-1'});


export const handler = async (event: any, context: any) => {
// rest of the logic...

return 'success';

}

backend.ts file:

import { defineBackend } from '@aws-amplify/backend';
import {Effect, PolicyStatement} from "aws-cdk-lib/aws-iam"
import { auth } from './auth/resource.js';
import { data } from './data/resource.js';
import { sendLinkEmail } from './functions/send-link-email/resource';
import { sendReportEmail } from './functions/send-report-email/resource';

const backend = defineBackend({
  auth,
  data,
  sendLinkEmail,
  sendReportEmail
});

Everything works well in sandbox. But while deployment, I am getting following error:

2024-09-22T19:41:30.538Z [INFO]: # Executing command: npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID --debug

54 2024-09-22T19:41:55.774Z [INFO]: [DEBUG] 2024-09-22T19:41:55.773Z: npm

55 2024-09-22T19:41:55.780Z [INFO]: [DEBUG] 2024-09-22T19:41:55.774Z: WARN exec The following package was not found and will be installed: [email protected]

56 2024-09-22T19:42:00.121Z [INFO]: [DEBUG] 2024-09-22T19:42:00.120Z: /codebuild/output/src4216656133/src/medical-amplify/node_modules/@aws-amplify/backend-function/src/factory.ts:35

57 CallerDirectoryExtractor,
    ^

59 SyntaxError: The requested module '@aws-amplify/platform-core' does not provide an export named 'CallerDirectoryExtractor'

60 at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)

61 at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Expected behavior
As it works well in the sandbox. This should deploy correctly.

Screenshots
Screenshot 2024-09-23 at 1 30 29 AM
Screenshot 2024-09-23 at 1 30 41 AM

Desktop (please complete the following information):

  • OS: IOS
  • Browser Chrome

How can I solve this issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    console-buildsIssues related to Amplify console buildspending-responseIssue is pending response from authorpending-triageIncoming issues that need categorizationtransferredIssue was transferred from another Amplify repository

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions