This repository was archived by the owner on Mar 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
AztecSDK with NextJS: Compile Error #665
Copy link
Copy link
Open
Description
Expected Behaviour
Following the documentation should produce a working app.
Current Behaviour
When making a new NextJS project, the app does not work. I created an example project to reproduce the error at: https://github.com/justinalexandershaw/with-nextjs
You should be able to clone that repository and then run npm install to install the project dependencies, and then npm run dev to start the website on localhost:3000.
The app currently stops with the following errors:
on chrome:
- Error: missing provider
- (argument="provider", value=undefined, code=INVALID_ARGUMENT, version=providers/5.0.21)
on brave:
- ./node_modules/@aztec/sdk/index.js
- Critical dependency: the request of a dependency is an expression
and
- WriteError: QuotaExceededError
- at eval (webpack-internal:///./node_modules/@aztec/sdk/index.js:662:2661)The build logs can be found here: https://github.com/justinalexandershaw/with-nextjs/blob/master/output.txt
Steps to Reproduce (for bugs)
- Create a new NextJS project (
npx create-next-app) - Install AzdecSDK (
npm install @aztec/sdk) - Update the webpack config for WASM:
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
webpack: (config) => {
config = {
plugins: [
new CopyPlugin({
patterns: [
{
from: 'node_modules/@aztec/sdk/*.(wasm|worker.js)',
to: '[name].[ext]',
},
],
}
),
], ...config};
return config
},
}- Run the installation script when the app loads:
import { createWalletSdk } from '@aztec/sdk';
const rollupProviderUrl = 'https://api.aztec.network/falafel';
const aztecSdk = await createWalletSdk(window.ethereum, rollupProviderUrl);
console.info(aztecSdk.getLocalStatus());
// initState: 'UNINITIALIZED'
await aztecSdk.init();
console.info(aztecSdk.getLocalStatus());
// initState: 'INITIALIZED'
await aztecSdk.destroy();
console.info(aztecSdk.getLocalStatus());
// initState: 'DESTROYED'Your Environment
Running on a Macbook Pro Intel 13" 2020
- AZTEC packages and their versions: @aztec/sdk: v2.0.87
- Node and yarn version: NodeJS v16.4.2, npm v7.18.1
- Operating System and version: macOS Big Sur 11.4
Metadata
Metadata
Assignees
Labels
No labels