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

The playground isn't running the Capability Tutorial Correctly #818

Open
flow-slack-issue-bot bot opened this issue Nov 6, 2024 · 3 comments
Open

Comments

@flow-slack-issue-bot
Copy link

flow-slack-issue-bot bot commented Nov 6, 2024

Reported by: Brian Doyle (<@brian.doyle>)

Issue Description:

This may be related to the log issue I created: Attempt the tutorial here: https://cadence-lang.org/docs/tutorial/capabilities

The Create Link tx appears to do nothing. Nothing appears in the log and it throws a console error:

Uncaught (in promise) Error: Network error: Unexpected token 'l', "flow.Storag"... is not valid JSON
at new t (bundle.esm.js:63:28)
at Object.error (bundle.esm.js:1030:48)
at _ (Observable.js:140:18)
at b (Observable.js:179:3)
at e.value (Observable.js:240:7)
at bundle.esm.js:899:36

Running the Tx again does log an error:

execution error code 1: [Error Code: 1101] error caused by: 1 error occurred:
* transaction execute failed: [Error Code: 1101] cadence runtime error: Execution failed:
error: failed to save object: path /public/HelloAssetTutorial in account 0x0000000000000006 already stores an object
--> b876e479e876ebd002b05c76942e5e4cdca7cd06d66a5f4eb0c1b87323f790f4:23:4
|
23 | account.capabilities.publish(capability, at: /public/HelloAssetTutorial)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I'm guessing this means the tx did work the first time?

@turbolent
Copy link
Member

turbolent commented Nov 6, 2024

There seems to be a bug in the Playground and it doesn't handle the result of the first execution of the transaction.

Then when you run it again, like the error says, you're trying to store a capability in /public/HelloAssetTutorial again, but there is now already one stored there. This is expected. Still, the first execution should be handled.

@joshuahannan
Copy link
Member

@nialexsan have you been able to take a look at this yet?

@nialexsan
Copy link
Contributor

I didn't finish fixing this bug, but I found where it happens.
I'll give it another try

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

No branches or pull requests

3 participants