0

I'm trying to access a contract on the completium-cli sandbox within my dapp running on a local vite server. Ideally I would set up my dev environment so I can test deploy to the sandbox within the dapp, interact with contracts in the sandbox etc while developing.

I'm not sure that the completium sandbox is meant to be used this way. If not, what should I use instead?

If it is meant to be used this way, how can I set up the sandbox so that CORS is disabled, and I can make server to server requests without getting CORS errors?

I am looking for something like this I can use with completium-cli:

How to make a tezos node set CORS headers

Otherwise I will attempt to set up my own sandbox or simply use ghostnet- but any suggestions for the best tools to get a sandbox running are appreciated

Thanks!

My settings:

      endpoint: 'http://localhost:20000/',
      network: NetworkType.CUSTOM,
      contract: 'KT1AngU9xZzkKXxc3Ln1MkCweZXtGGroJbPu',

Completium-cli is initiated and works fine with ghostnet and main net if I change the endpoint and network above.

Console error:

Access to fetch at 'http://localhost:20000/chains/main/blocks/head/context/contracts/KT1AngU9xZzkKXxc3Ln1MkCweZXtGGroJbPu' from origin 'http://localhost:3000' has been blocked by CORS policy:
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

2 Answers 2

0
+50

I don't how compleium passes arguments/environement-variables to flextesa but it should be just about setting flextesa_node_cors_origin='*'.

(this should be in the --help of the flextesa commands)

0

The completium sandbox is a simple wrap of flextesa.

You don't need completium to launch flexteza; once flexteza is launched, you can then set the endpoint to sandbox and work with completium as usual.

docker run --rm --name my-sandbox --detach -p 20000:20000 --cpus 1 -e block_time=10 oxheadalpha/flextesa:latest mumbaibox start

You can add the cors policy settings as stated by Sebastien the following:

docker run --rm --name my-sandbox --detach -p 20000:20000 --cpus 1 -e block_time=10 -e flextesa_node_cors_origin='*' oxheadalpha/flextesa:latest mumbaibox start
1
  • Thanks - apparently I just need to set flextesa_node_cors_origin='*'. How can I get completium to pass arguments / environment variables to flextesa?
    – Grum
    May 16 at 1:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.