Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: aoconnect spawn does not work with localnet #16

Closed
atticusofsparta opened this issue Apr 17, 2024 · 7 comments
Closed

BUG: aoconnect spawn does not work with localnet #16

atticusofsparta opened this issue Apr 17, 2024 · 7 comments

Comments

@atticusofsparta
Copy link

Hardware: Mac m3 (arm)

aoconnect: v0.0.45

When starting up the local server, you need to spawn a process so that it is available on the scheduler. Doing so results in aoconnect throwing an error from zod saying the return type is invalid.

Ideally aoconnect works with this so that ao-localnet can be used in CI/CD pipelines for automated testing.

@MichaelBuhler
Copy link
Contributor

MichaelBuhler commented Apr 17, 2024

This is probably not an error in ao-localnet. There are many environment variables that aoconnect and its dependencies use to override the testnet defaults. Which ones are you settings?

Some that probably need to be set:

GATEWAY_URL=http://localhost:4000
GRAPHQL_URL=http://localhost:4000/graphql
CU_URL=http://localhost:4004
MU_URL=http://localhost:4002

@atticusofsparta
Copy link
Author

Yup, i set those - Maybe its more like the scheduler location in the spawn call? I did publish the location first, then used that in the spawn call.

@MichaelBuhler
Copy link
Contributor

@atticusofsparta When spawning, the scheduler value is the wallet address of the wallet that published the Scheduler-Location record.

I'll need to see more of your code and/or logs to be of more help.

@atticusofsparta
Copy link
Author

Hm - ok let me try it again and get a branch up on my fork for examples.

@atticusofsparta
Copy link
Author

atticusofsparta commented Apr 18, 2024

@MichaelBuhler I set up aoconnect in an experiments folder here: https://github.com/atticusofsparta/ao-localnet

the logs arent really helpful, atleast not the stack trace:

atticus@macbook36gb atticus-ao-localnet % node experiments/aoconnect.js           
deploying module
deploying module HOCF-8TPmbmx9xMNBpyGM4nvN-Zd7EUHex9QPNpC62s to bundler
spawning process with module id HOCF-8TPmbmx9xMNBpyGM4nvN-Zd7EUHex9QPNpC62s
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: Invalid Return 'undefined': Required.
    at errFrom (file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:447:9)
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:17:18
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:17:14
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:17:14
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)ZodError: [
  {
    "code": "invalid_return_type",
    "returnTypeError": {
      "issues": [
        {
          "code": "invalid_type",
          "expected": "object",
          "received": "undefined",
          "path": [],
          "message": "Required"
        }
      ],
      "name": "ZodError"
    },
    "path": [],
    "message": "Invalid function return type"
  }
]
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/zod/lib/index.mjs:3166:31
    at Object.fork (file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:39:17)
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:21:61
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:35:37
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:21:38
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:14:36
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:14:36
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:21:38
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:21:38
    at file:///Users/atticus/Documents/code/ao/atticus-ao-localnet/node_modules/@permaweb/aoconnect/dist/index.js:21:38

Node.js v18.19.1

@MichaelBuhler
Copy link
Contributor

I think atticusofsparta#1 resolves your problem and this issue. But this exercise has exposed problems with the custom bundler inside the localnet (#17).

@atticusofsparta
Copy link
Author

atticusofsparta commented Apr 19, 2024

Ah, I see. Alright maybe the better option here is getting the turbo bundler working - ill see if I can do something for that... I get that the L1 patch can get it working but I would rather match production systems as close as possible for testing accuracy.

Thanks for taking a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants