Closed RodrigoTomeES closed 2 months ago
Hi @RodrigoTomeES sorry that you encountered this issue. You can resolve this issue by upgrading both aws-amplify
and @aws-amplify/adapter-nextjs
package to the latest versions.
@HuiSF hi, I tried it but it doesn't work I receive both errors together. The error of aws-amplify and the error of nextjs-adapter package
Hi @RodrigoTomeES I just tried using bun
to create a new Next.js app, with installing
"@aws-amplify/adapter-nextjs": "^1.2.5",
"aws-amplify": "^6.3.7",
And using the createServerRunner
and generateServerClientUsingCookies
functions exported from @aws-amplify/adapter-nextjs
packages.
bun next build
compiled the source code without errors.
Could you try the following steps:
node_modules
, and .next
directories (.next
contains the Next app build cache)bun install
to install dependencies (make sure you have the latest versions specified for aws-amplify
and @aws-amplfiy/adaper-nextjs
)bun next build
Hi @HuiSF I followed your steps but I had the same error:
$ next build
▲ Next.js 14.2.4
Creating an optimized production build ...
Failed to compile.
./node_modules/@aws-amplify/data-schema-types/lib-esm/index.d.ts
Module not found: Can't resolve './builder'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/generateClient.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/InternalAPI.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/generateServerClient.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/index.mjs
./lib/fetch/utils.ts
./app/api/batchLine/route.ts
./node_modules/@aws-amplify/data-schema-types/lib-esm/index.d.ts
Module not found: Can't resolve './client'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/generateClient.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/InternalAPI.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/generateServerClient.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/index.mjs
./lib/fetch/utils.ts
./app/api/batchLine/route.ts
./node_modules/@aws-amplify/data-schema-types/lib-esm/index.d.ts
Module not found: Can't resolve './util'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/generateClient.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/InternalAPI.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/generateServerClient.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/index.mjs
./lib/fetch/utils.ts
./app/api/batchLine/route.ts
./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
export '__modelMeta__' (reexported as '__modelMeta__') was not found in '@aws-amplify/data-schema-types' (module has no exports)
Import trace for requested module:
./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/generateClient.mjs
./node_modules/@aws-amplify/api-graphql/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/InternalAPI.mjs
./node_modules/@aws-amplify/api/dist/esm/internals/index.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/generateServerClient.mjs
./node_modules/@aws-amplify/adapter-nextjs/dist/esm/api/index.mjs
./lib/fetch/utils.ts
./app/api/batchLine/route.ts
> Build failed because of webpack errors
error: script "build" exited with code 1
This is our package.json
{
"name": "project",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev:turbo": "next dev --turbo",
"debug": "cross-env NODE_OPTIONS='--inspect' next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"format": "prettier --ignore-path .gitignore --write .",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"dependencies": {
"@aws-amplify/adapter-nextjs": "1.2.5",
"@hookform/resolvers": "3.6.0",
"@radix-ui/react-accordion": "1.1.2",
"@radix-ui/react-avatar": "1.0.4",
"@radix-ui/react-checkbox": "1.0.4",
"@radix-ui/react-dialog": "1.0.5",
"@radix-ui/react-dropdown-menu": "2.0.6",
"@radix-ui/react-icons": "1.3.0",
"@radix-ui/react-label": "2.0.2",
"@radix-ui/react-popover": "1.0.7",
"@radix-ui/react-progress": "1.0.3",
"@radix-ui/react-radio-group": "1.1.3",
"@radix-ui/react-select": "2.0.0",
"@radix-ui/react-separator": "1.0.3",
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-tabs": "1.0.4",
"@tanstack/react-table": "8.17.3",
"aws-amplify": "6.3.7",
"class-variance-authority": "0.7.0",
"clsx": "2.1.1",
"cmdk": "1.0.0",
"next": "14.2.4",
"next-themes": "0.3.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hook-form": "7.52.0",
"shadcn-ui": "0.8.0",
"sonner": "1.5.0",
"tailwind-merge": "2.3.0",
"tailwindcss-animate": "1.0.7",
"zod": "3.23.8"
},
"devDependencies": {
"@aws-amplify/cli": "12.12.3",
"@total-typescript/ts-reset": "0.5.1",
"@types/node": "20.14.5",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"autoprefixer": "10.4.19",
"cross-env": "7.0.3",
"eslint": "8.57.0",
"eslint-config-next": "14.2.4",
"postcss": "8.4.38",
"postcss-functions": "4.0.2",
"prettier": "3.3.2",
"tailwindcss": "3.4.4",
"typescript": "5.4.5"
}
}
@HuiSF in your test did you use the code snippet that I added to the issue?
Hi @RodrigoTomeES looking at this path ./node_modules/@aws-amplify/data-schema-types/lib-esm/index.d.ts
this is from a very old version of the @aws-amplify/data-schema-types
package while the newer version of the @aws-amplify/data-schema
is pointing to ./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs
. It's likely bun
has its own cache somewhere (sorry I'm not very familiar with bun's package manager)
Could you also try to remove package lock file, clear bun's cache and redo the steps mentioned above?
If it installs everything correctly, when you run bun pm ls --all
, you should see the following:
├── @aws-amplify/adapter-nextjs@1.2.5
├── @aws-amplify/analytics@7.0.35
├── @aws-amplify/api@6.0.37
├── @aws-amplify/api-graphql@4.1.6
│ └── @aws-sdk/types@3.387.0
├── @aws-amplify/api-rest@4.0.35
├── @aws-amplify/auth@6.3.6
├── @aws-amplify/core@6.3.2
├── @aws-amplify/data-schema@1.3.2
├── @aws-amplify/data-schema-types@1.0.1
├── @aws-amplify/datastore@5.0.37
├── @aws-amplify/notifications@2.0.35
├── @aws-amplify/storage@6.4.6
├── aws-amplify@6.3.7
@HuiSF you are rigth, I need to remove bun.lockb to make it work, thanks!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
Authentication, GraphQL API
Amplify Version
v6
Amplify Categories
auth, api
Backend
Amplify CLI
Environment information
Describe the bug
After upgrade the package @aws-amplify/adapter-nextjs 1.1.4 to 1.1.5 we experimented this error when building the app:
We are using Bun
Expected behavior
Compile without errors
Reproduction steps
We tried to make a minimal reproduction but we have not been able to achieve it and the code is not public
Code Snippet
The file with the issue
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
Maybe can be related with issue #13514