[Solved] Problem occurs when calling getContractInstance() Method

I’m using React to create an aepp on Aeternity.

I receive an error: “Compiler not defined” whenever I make a call to getContractInstance().

Snippet of my code:

import Ae from '@aeternity/aepp-sdk/es/ae/universal';

.
.
.

Ae({
  url: 'https://sdk-testnet.aepps.com',
  internalUrl: 'https://sdk-testnet.aepps.com',
  networkId: 'ae_uat',
  nativeMode: true
}) .then(ae => {
  console.log(ae)
  ae.getContractInstance(contractSource, { contractAddress }) // this is where I get the error
  
})
3 Likes

Hello, in your client initialization you also need to pass the url of a hosted compiler, e.g. compilerUrl: "https://compiler.aepps.com"

1 Like

Thanks a lot for the fast response. I carried out your instructions, however I got a new error.

This is the error:

Error: Http request for https://compiler.aepps.com/aci failed with status code 403. Status: Forbidden. 
Error data: {"reason":"Parse errors\nline 4, column 5: Unexpected token vsemi"}
    at processResponse (http.js:31)

This indicates there is an error in your contractsource around the given line

1 Like

If you post (parts of) your contract I would be glad to help

Thanks for the suggestion you made about the problem coming from the Contract Source, I made some changes and everything works perfectly. I’m really greatful.

2 Likes

Hello please what did you change because I am presently facing the same problem

GET https://sdk-testnet.aepps.com/v2/accounts/ak_2JauhY2uj4YEcRzpci6vdHdAFAoazuC3bmkBvs7iwrzrjaHcP 404

 POST https://compiler.aepps.com/aci 403
    
Uncaught (in promise) Http request for https://compiler.aepps.com/aci failed with status code 403. Status: . 
    Error data: {"reason":"Parse errors\nline 4, column 3: Unexpected token vsemi"}
    window.addEventListener
    async function (async)
    window.addEventListener
    load (async)
    (anonymous)
    payment.js:118 Uncaught (in promise) TypeError: Cannot read property 'methods' of null
        at HTMLButtonElement.<anonymous> (payment.js:118)
        at HTMLButtonElement.dispatch (jquery-min.js:3)
        at HTMLButtonElement.r.handle (jquery-min.js:3)

@emmanueljet what is your contract? there is an issue in your contract source