GithubHelp home page GithubHelp logo

ltfschoen / mudtemplate Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 158 KB

Build Ethereum DApps with MUD v2 in a Docker container

License: Apache License 2.0

Shell 53.46% Dockerfile 46.54%
docker ethereum foundry lattice mud vitejs anvil cast chisel forge

mudtemplate's Issues

CORS: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:8545/. (Reason: CORS request did not succeed). Status code: (null)

  • Unresolved CORS issue as shown in below screenshot when I open my browser at http://localhost:3000 on the host machine after running pnpm run dev (following README instructions), with the anvil server running and all contracts deployed via RPC to 127.0.0.1:8545.
Screen Shot 2023-05-17 at 8 44 17 pm
  • At this stage to try to avoid this CORS issue accessing the DApp in the Docker container from the host machine (see latticexyz/mud#860), I tried doing what was suggested here latticexyz/mud#860 (comment) by editing my-project/node_modules/.pnpm/[email protected]/node_modules/vite/dist/client/client.mjs by changing the line const socketHost = ${__HMR_HOSTNAME__ || importMetaUrl.hostname}:${hmrPort || importMetaUrl.port}${__HMR_BASE__}; to instead be const socketHost = '127.0.0.1:8545';. Relates to vitejs/vite#652 that possibly hasn't been resolved yet and possibly should be re-opened. Unfortunately that doesn't appear to resolve the issue.
  • I have also tried to modify packages/client/vite.config.ts. See the Vitejs docs https://vitejs.dev/config/server-options.html#server-cors. But even if I allow all origins and headers it still generates the error after I restart it.
export default defineConfig({
  plugins: [react()],
  server: {
    port: 3000,
    fs: {
      strict: false,
    },
    cors: {
      // origin: ["ws://127.0.0.1:8545/", "http://127.0.0.1:8545/", "http://localhost:3000/"],
      origin: "*",
      // methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE', 'OPTIONS'],
      methods: "*",
      // allowedHeaders: ['Content-Type', 'Authorization'],
      allowedHeaders: "*",
      credentials: true,
      // exposedHeaders: ['Content-Range', 'X-Content-Range'],
      exposedHeaders: "*",
      // preflightContinue: true,
      // optionsSuccessStatus: 204
    },
    // hmr: {
    //   clientPort: 8545,
    //   port: 3000,
    //   overlay: true,
    // }
    // proxy: {
    //   '/socket.io': {
    //     target: 'ws://127.0.0.1:8545',
    //     ws: true,
    //   },
    // },
    // strictPort: false,
  },

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.