sendinblue / APIv3-nodejs-library

SendinBlue's API v3 Node.js Library
ISC License
101 stars 47 forks source link

Using NextJS: Build works locally, but fails during AWS Amplify build process #120

Closed 19Sean96 closed 1 year ago

19Sean96 commented 2 years ago

I do not submit issues often, so please let me know if I miss any information below and I'll happily provide what I can.

Package.json Info

1. sib-api-v3-sdk version: "^8.3.0"
2. next version: "latest"

Amplify.yml file:

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - yarn install
    build:
      commands:
        - yarn run build
  artifacts:
    baseDirectory: .next
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*

Error Information:

The problem When amplify begins to run the SSR build process, it fails with exit code 1 due to not being able to resolve modules within the sib-api-v3-sdk/src directory. Example:

Module not found: Can't resolve 'ApiClient' in '/codebuild/output/src541033312/src/WireWise-Marketing/node_modules/sib-api-v3-sdk/src'
                                  Did you mean './ApiClient'?

It seems all other modules within this package are also not being resolved, and I'm at a loss for words as to why this could be occuring. I will attach the build log file for further information.

log.txt

19Sean96 commented 2 years ago

Update:

I attempted the build on vercel.com and it does build successfully (which I suspected since NextJS is owned by them so it's highly optimized for that particular framework).
I suspect the failed build on Amplify could have to do with how NextJS parses packages during SSR, but I haven't had to really worry about that until today.

I'm going to attempt to use Webpack next to see if it has something to do with AMD parsing - which I wasn't familiar with until today. I suspect NextJS has this enabled by default - not entirely sure though.

morneluckybeard commented 1 year ago

@19Sean96 any luck? I'm experiencing the same issue here :(

shubhamUpadhyayInBlue commented 1 year ago

Hi @19Sean96 Honestly, I haven't used AWS Amplify.

When amplify begins to run the SSR build process, it fails with exit code 1 due to not being able to resolve modules within the sib-api-v3-sdk/src directory.

Thanks.

shubhamUpadhyayInBlue commented 1 year ago

Since there is no response from the user for more than 11 days, I am closing this issue.