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

Tasks do not run when visiting with sharing url (not logged in) #8533

Open
3 tasks done
schettn opened this issue Aug 6, 2024 · 7 comments
Open
3 tasks done

Tasks do not run when visiting with sharing url (not logged in) #8533

schettn opened this issue Aug 6, 2024 · 7 comments

Comments

@schettn
Copy link

schettn commented Aug 6, 2024

🐛 bug report

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project
    adheres to.
  • I have searched the issue tracker for an issue that matches the one I want
    to file, without success.

Description of the problem

How has this issue affected you? What are you trying to accomplish?

When accessing a CodeSandbox project through a sharing URL without being logged in, tasks that are supposed to run automatically do not execute as expected.

image

When accessing the same sandbox as my user, everything works fine.
image

To Reproduce

Link to sandbox: https://codesandbox.io/p/github/getcronit/pylon-template/main?file=%2Fsrc%2Findex.ts%3A18%2C1

Link to repo: https://github.com/getcronit/pylon-template

Maybe related: #8442

Your Environment

Software Name/Version
Сodesandbox Latest
Browser Safari / Chrome
Operating System MacOS
@filipelima18
Copy link
Contributor

Hi @schettn. I was unable to reproduce the issue you described. Taking our public Docs repo as an example (https://codesandbox.io/p/github/codesandbox/docs/main), it opens the tasks and previews on startup both for logged-in and unauthenticated users.

I also tried to replicate this on the URL you provided but it seems that the start task is failing.

@schettn
Copy link
Author

schettn commented Aug 8, 2024

Mhm.. Do you have any idea why the start task does not fail when logged on? How can I debug this?

This is my tasks.json:

{
  // These tasks will run in order when initializing your CodeSandbox project.
  "setupTasks": [
    {
      "name": "Install Dependencies",
      "command": "bun install"
    }
  ],

  // These tasks can be run from CodeSandbox. Running one will open a log in the app.
  "tasks": {
    "Start": {
      "name": "Start",
      "command": "bun develop",
      "runAtStart": true,
      "preview": {
        "port": 3000
      }
    }
  }
}

@schettn
Copy link
Author

schettn commented Aug 13, 2024

Hi @filipelima18. I recorded a video that shows that it no longer works after I log out. I. have no idea what could be wrong.
I would appreciate it if you could help me out on this!

Screen.Recording.2024-08-13.at.08.31.44.mov

@filipelima18
Copy link
Contributor

Hi @schettn. I shared this with the engineering team for analysis. Thank you for your patience while we figure out what might be causing this.

@CompuIves
Copy link
Member

Hey! I've looked at the issue, and I believe this is happening because of some confusing behaviour in CodeSandbox itself (which I think we should fix). If you open a repo as an anonymous user, you open a different version than if you open it signed in (in your workspace). Because of this, the public version is not running the tasks.

However, I think that you are looking to share a template for other people to see and potentially fork, and for that we have a different functionality in CodeSandbox that's built for that purpose that should work in your case! If you use this URL:

http://codesandbox.io/p/devbox/github/getcronit/pylon-template/main?file=/src/index.ts:18,1

You will get a link back to a template that is anonymous, but stays synced with the GitHub repository. Everyone will see the same version, and they can fork it if they want to have their own version of it. We're working on revamping the import modal to make that distinction more clear. I hope this helps!

@schettn
Copy link
Author

schettn commented Aug 14, 2024

@CompuIves This makes sense!

Where did you get this URL from?

I thought that I had to get the sharing link. But the sharing link is not the devbox.

image

@schettn
Copy link
Author

schettn commented Aug 14, 2024

Ah I see. My project isn't a Devbox right?

image

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

3 participants