metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

Fair Launch TypeError. Doesnt launch correctly. #1306

Closed Fiercevd closed 2 years ago

Fiercevd commented 2 years ago

Fair Launch isn't work correctly.

When yarn start in the FLP folder there is an issue:

TypeError: Cannot read properties of undefined (reading 'slice')

image image

catsonmats commented 2 years ago

Also receiving this error. My reproduction steps:

  1. Successfully run the upload command from the v2 cli
  2. Input candy machine ID into the .env
  3. Uncomment devnet options in .env, comment out mainnet options
  4. yarn start
  5. Successful start of dev server, try to reach localhost:3000, receive error
guillemap commented 2 years ago

The problem comes when loading the canvas-confetti module. Don't want to submit a PR as this is not a real fix, but you can circumvent the compiling error by editing the file ~/[...]/fair-launch/src/confetti.tsx and adding // @ts-ignore right before import confetti from 'canvas-confetti';:

import confetti from 'canvas-confetti';    ->    // @ts-ignore
                                                 import confetti from 'canvas-confetti';
trimpage commented 2 years ago

@guillemavila i tried this but it still doesn't work

Aaron-ATL commented 2 years ago

@guillemavila @trimpage I am having the exact same issue. Cannot read properties of undefined (reading 'slice')

@guillemavila's fix did not work unfortunately. Why is this happening?

JFK344 commented 2 years ago

Anyone managed to get it started ?

akserikawa commented 2 years ago

Having the same problem. @guillemavila fix doesn't work. Do you have any other ideas about what it might be causing this?

limjame28 commented 2 years ago

im having the same trouble here

epomatti commented 2 years ago

same same, fresh from master

image

epomatti commented 2 years ago

Error comes from other folders, not fair-launch folder. Since its a monorepo ts checks for everything it seems.

Solution: Copy paste fair-launch to a different directory and build separately

or checkout to this commit 56de262

That works for me.

๐Ÿ‘Ž This only lead me to another issue:

Failed to compile.

/extras/fair-launch/src/confetti.tsx
TypeScript error in /extras/fair-launch/src/confetti.tsx(2,22):
Could not find a declaration file for module 'canvas-confetti'. '/extras/fair-launch/node_modules/canvas-confetti/src/confetti.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/canvas-confetti` if it exists or add a new declaration (.d.ts) file containing `declare module 'canvas-confetti';`  TS7016

    1 | import React, { useContext, useEffect, useMemo, useRef } from 'react';
  > 2 | import confetti from 'canvas-confetti';
      |                      ^
    3 | 
    4 | export interface ConfettiContextState {
    5 |   dropConfetti: () => void;

image

akserikawa commented 2 years ago

@epomatti Try what the error says ;)

npm i --save-dev @types/canvas-confetti

akserikawa commented 2 years ago

It's seems it's an error known by the team, try running the frontend from this branch, instead of master

git checkout fix-arweave-upload yarn install yarn start

epomatti commented 2 years ago

@akserikawa yes did that, but still getting this:

@epomatti Try what the error says ;)

image

epomatti commented 2 years ago

@akserikawa I also don't feel comfortable with using different branches for different modules.

It's seems it's an error known by the team, try running the frontend from this branch, instead of master

I'm running a production project and the monorepo is supposed to keep everything compatible across the different modules, as everything depends pretty much on the candy machine behavior, and don't want to run into weird incompatibility scenarios.

Looking at the fix-arweave-upload name it doesn't look like it is related to at all to the problem we're facing, so I have no idea what it's in there.

If it was fixed, then why whoever did it didn't just create a small new branch and did the PR separately?

akserikawa commented 2 years ago

Totally agree with you. master branch should have working, deployable code.

But it seems the team knows about the issue and I guess they will work on it.

For now, I got it working extracting the whole fair-launch folder from the fix-arweave-upload branch to my own repository and installing the confetti package with npm i --save-dev @types/canvas-confetti

marcelc63 commented 2 years ago

Error comes from other folders, not fair-launch folder. Since its a monorepo ts checks for everything it seems. Solution: Copy paste fair-launch to a different directory and build separately or checkout to this commit 56de262 That works for me.

๐Ÿ‘Ž This only lead me to another issue:

Failed to compile.

/extras/fair-launch/src/confetti.tsx
TypeScript error in /extras/fair-launch/src/confetti.tsx(2,22):
Could not find a declaration file for module 'canvas-confetti'. '/extras/fair-launch/node_modules/canvas-confetti/src/confetti.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/canvas-confetti` if it exists or add a new declaration (.d.ts) file containing `declare module 'canvas-confetti';`  TS7016

    1 | import React, { useContext, useEffect, useMemo, useRef } from 'react';
  > 2 | import confetti from 'canvas-confetti';
      |                      ^
    3 | 
    4 | export interface ConfettiContextState {
    5 |   dropConfetti: () => void;

image

Ok ill delete my answer

beaubrewer commented 2 years ago

I can confirm the steps posted by @akserikawa worked for me. Not a great solution, but the best option we have at the moment to mint with CMv2.

guillemap commented 2 years ago

The problem comes when loading the canvas-confetti module. Don't want to submit a PR as this is not a real fix, but you can circumvent the compiling error by editing the file ~/[...]/fair-launch/src/confetti.tsx and adding // @ts-ignore right before import confetti from 'canvas-confetti';:

import confetti from 'canvas-confetti';    ->    // @ts-ignore
                                                 import confetti from 'canvas-confetti';

A detail I ignored and might be important: I've copied the fair-launch folder in another location, which is what I'm deploying to cloudflare pages. @MarkSackerberg explains a possible solution here too.

ghost commented 2 years ago

@MarkSackerberg explains a possible solution here too.

Remote branch fix-arweave-upload not found in upstream origin

nikhilm056 commented 2 years ago

It seems like the branch fix-arweave-upload is no longer available and master is still not working. @akserikawa If possible, can you please share the working copy of the fair-launch folder on some secure location? That would be really helpful for the other developers as well.

devcodeash commented 2 years ago

I copied fair-launch folder to another location then deleted node_modules and did yarn install yarn add @types/canvas-confetti --dev now minting is working

ghost commented 2 years ago

I copied fair-launch folder to another location then deleted node_modules and did yarn install yarn add @types/canvas-confetti --dev now minting is working

Followed those steps, then moved the folder back and it works. Thanks!

nikhilm056 commented 2 years ago

Yes, now it's working for me as well. Thank you @devcodeash !