Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Error: Uncaught (in promise): Error: Invalid response: 403 Forbidden #101

Closed
ysharoiko opened this issue Feb 27, 2018 · 22 comments
Closed

Comments

@ysharoiko
Copy link

ysharoiko commented Feb 27, 2018

Anybody knows what is it? I cannot get it running. Linux MInt 18.1 64 bit, python3.5
I've installed
scriptedforms

but when i run test.py

I got Error in browser

Error
While rendering your form an error occured.

The error from the Angular compiler is printed below:

Error: Uncaught (in promise): Error: Invalid response: 403 Forbidden
Error: Invalid response: 403 Forbidden
at new ResponseError (http://localhost:8888/scriptedforms/jupyterlab.js:12:2165)
at http://localhost:8888/scriptedforms/jupyterlab.js:42:434820
at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7588)
at Object.onInvoke (http://localhost:8888/scriptedforms/angular.js:36:1048)
at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7528)
at Zone.run (http://localhost:8888/scriptedforms/polyfills.js:36:2675)
at http://localhost:8888/scriptedforms/polyfills.js:43:2054
at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8321)
at Object.onInvokeTask (http://localhost:8888/scriptedforms/angular.js:36:950)
at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8242)

cat test.py

#!/usr/bin/env python3
import scriptedforms as sf
 
# workaround for https://github.com/SimonBiggs/scriptedforms/issues/24
def create_file(filename, contents):
    with open(filename, 'w') as f:
        f.write(contents)
 
filename = 'quick-start.md'
markdown_contents = """
# An example
 
<section-live>
 
<variable-string>your_name</variable-string>
 
```python
print('Hello {}!'.format(your_name))
```
 
</section-live>"""
 
create_file(filename, markdown_contents)
sf.load(filename)
@SimonBiggs
Copy link
Owner

SimonBiggs commented Feb 27, 2018

What version of the pypi package notebook do you have? Run pip freeze to read off the version number. After you've checked that version and let me know can you try and run the following:

pip uninstall scriptedforms
pip install scriptedforms --no-cache

Let me know if that fixes it.

Also, on GitHub to make the scriptedforms content display properly surround them with the following tags:

~~~python
Write test.py contents in here
~~~

@SimonBiggs
Copy link
Owner

@ysharoiko How did you go with this issue?

@DevanR
Copy link

DevanR commented Mar 6, 2018

Hello Simon,

Facing the same issue with your quick-start example on OSX High Sierra 10.13.3 with Python 3.6.4.

This is the error message on the browser:

Error: Uncaught (in promise): Error: Invalid response: 403 Forbidden Error: Invalid response: 403 Forbidden at new ResponseError (http://localhost:8888/scriptedforms/jupyterlab.js:12:2165) at http://localhost:8888/scriptedforms/jupyterlab.js:42:434819 at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7588) at Object.onInvoke (http://localhost:8888/scriptedforms/angular.js:36:1048) at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7528) at Zone.run (http://localhost:8888/scriptedforms/polyfills.js:36:2675) at http://localhost:8888/scriptedforms/polyfills.js:43:2054 at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8321) at Object.onInvokeTask (http://localhost:8888/scriptedforms/angular.js:36:950) at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8242) at Zone.runTask (http://localhost:8888/scriptedforms/polyfills.js:36:3372) at drainMicroTaskQueue (http://localhost:8888/scriptedforms/polyfills.js:36:386) at

And the following is the error message on the Terminal:

[I 11:16:24.202 ScriptedForms] Accepting one-time-token-authenticated connection from ::1 [W 11:16:26.885 ScriptedForms] 403 POST /api/sessions?1520334986878 (::1): '_xsrf' argument missing from POST [W 11:16:26.885 ScriptedForms] '_xsrf' argument missing from POST [W 11:16:26.886 ScriptedForms] 403 POST /api/sessions?1520334986878 (::1) 2.36ms referer=http://localhost:8888/scriptedforms/quick-start.md token=fd089f9decab812ff40bce698b3a7d18e925804d01b2155f [W 11:16:26.889 ScriptedForms] 403 POST /api/sessions?1520334986882 (::1): '_xsrf' argument missing from POST [W 11:16:26.889 ScriptedForms] '_xsrf' argument missing from POST [W 11:16:26.890 ScriptedForms] 403 POST /api/sessions?1520334986882 (::1) 2.03ms referer=http://localhost:8888/scriptedforms/quick-start.md?token=fd089f9decab812ff40bce698b3a7d18e925804d01b2155f

I tried your suggestions above but it still did not work.

I also tried setting the the following option in the jupyter notebook global config:
c.NotebookApp.disabl_check_xsrf = True

But it had no effect.

Hope this helps.

@SimonBiggs
Copy link
Owner

SimonBiggs commented Mar 6, 2018

Can you run pip freeze and then tell me what version of the package notebook is installed?

Also if you do the following:

https://github.com/SimonBiggs/scriptedforms#optional-installing-the-jupyter-server-extension

Does that make a difference?

@SimonBiggs SimonBiggs reopened this Mar 6, 2018
@DevanR
Copy link

DevanR commented Mar 6, 2018

notebook==5.4.0

Installing with jupyter extension results in the following:

(scripted_forms) DEVML0204889:scripted_forms dre09$ jupyter nbextension install --py scriptedforms Traceback (most recent call last): File "/Users/dre09/.pyenv/versions/scripted_forms/bin/jupyter-nbextension", line 11, in <module> sys.exit(main()) File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs) File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/traitlets/config/application.py", line 658, in launch_instance app.start() File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/notebook/nbextensions.py", line 988, in start super(NBExtensionApp, self).start() File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/jupyter_core/application.py", line 255, in start self.subapp.start() File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/notebook/nbextensions.py", line 716, in start self.install_extensions() File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/notebook/nbextensions.py", line 695, in install_extensions **kwargs File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/notebook/nbextensions.py", line 211, in install_nbextension_python m, nbexts = _get_nbextension_metadata(module) File "/Users/dre09/.pyenv/versions/3.6.4/envs/scripted_forms/lib/python3.6/site-packages/notebook/nbextensions.py", line 1125, in _get_nbextension_metadata 'it is missing the_jupyter_nbextension_paths()method.'.format(module)) KeyError: 'The Python module scriptedforms is not a valid nbextension, it is missing the_jupyter_nbextension_paths()method.'

@SimonBiggs
Copy link
Owner

What version of scriptedforms are you running?

@DevanR
Copy link

DevanR commented Mar 7, 2018

scriptedforms==0.6.5

@SimonBiggs
Copy link
Owner

SimonBiggs commented Mar 7, 2018

What if you try the following:

jupyter serverextension enable --py scriptedforms

Then try:

jupyter notebook --NotebookApp.default_url=/scriptedforms/quick-start.md

@DevanR
Copy link

DevanR commented Mar 7, 2018

Bingo! It works for me now. I also had to have the following in the jupyter global config:
c.NotebookApp.disable_check_xsrf = True

Thank you for the help. I've added the terminal output below for reference.

`
(scripted_forms) DEVML0204889:scripted_forms dre09$ jupyter notebook --NotebookApp.default_url=/scriptedforms/quick-start.md
[I 11:06:13.566 NotebookApp] Serving notebooks from local directory: /Users/dre09/Workspace/github/scripted_forms
[I 11:06:13.566 NotebookApp] 0 active kernels
[I 11:06:13.566 NotebookApp] The Jupyter Notebook is running at:
[I 11:06:13.566 NotebookApp] http://localhost:8888/?token=018a74c23e47da2f9e2c9c2e19a32e98fb2e55dfe3c55b33
[I 11:06:13.566 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:06:13.567 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=018a74c23e47da2f9e2c9c2e19a32e98fb2e55dfe3c55b33

[I 11:06:13.913 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 11:06:15.676 NotebookApp] Kernel started: 10d4afed-71d7-4a49-9b16-5cab4ebd1d85
[I 11:06:15.707 NotebookApp] Kernel started: 1370eb07-4505-4b5a-a945-76955bc6f597
[I 11:06:16.957 NotebookApp] Adapting to protocol v5.1 for kernel 10d4afed-71d7-4a49-9b16-5cab4ebd1d85
[I 11:06:16.993 NotebookApp] Adapting to protocol v5.1 for kernel 1370eb07-4505-4b5a-a945-76955bc6f597
Fontconfig warning: "/usr/local/etc/fonts/fonts.conf", line 146: blank doesn't take any effect anymore. please remove it from your fonts.conf
`

@SimonBiggs
Copy link
Owner

Thanks for the feedback. It still should work with just plain scriptedforms quick-start.md. So I'd still like to get to the bottom of what is going on.

If you remove the c.NotebookApp.disable_check_xsrf = True setting what does plain old jupyter notebook give you? And then also what output does jupyter notebook --NotebookApp.default_url=/scriptedforms/quick-start.md give?

@DevanR
Copy link

DevanR commented Mar 7, 2018

After removing the setting. I ran the two following commands.

(scripted_forms) DEVML0204889:scripted_forms dre09$ jupyter notebook
[I 23:49:07.719 NotebookApp] Serving notebooks from local directory: /Users/dre09/Workspace/github/scripted_forms
[I 23:49:07.720 NotebookApp] 0 active kernels
[I 23:49:07.720 NotebookApp] The Jupyter Notebook is running at:
[I 23:49:07.720 NotebookApp] http://localhost:8888/?token=20605126b903b18406b80cb676199f964358a02b93a3b423
[I 23:49:07.720 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 23:49:07.723 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=20605126b903b18406b80cb676199f964358a02b93a3b423

[I 23:49:08.070 NotebookApp] Accepting one-time-token-authenticated connection from ::1

(scripted_forms) DEVML0204889:scripted_forms dre09$ jupyter notebook --NotebookApp.default_url=/scriptedforms/quick-start.md
[I 23:50:18.731 NotebookApp] Serving notebooks from local directory: /Users/dre09/Workspace/github/scripted_forms
[I 23:50:18.731 NotebookApp] 0 active kernels
[I 23:50:18.731 NotebookApp] The Jupyter Notebook is running at:
[I 23:50:18.731 NotebookApp] http://localhost:8888/?token=7236c210167d3aa9dde807183e9d67fb6a2865303c5c4fc0
[I 23:50:18.731 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 23:50:18.732 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=7236c210167d3aa9dde807183e9d67fb6a2865303c5c4fc0

[I 23:50:18.966 NotebookApp] Accepting one-time-token-authenticated connection from ::1
[I 23:50:20.732 NotebookApp] Kernel started: 6017d44f-6235-466b-9417-c18f22c4697e
[I 23:50:20.792 NotebookApp] Kernel started: 92a292d5-9c3d-424d-96b0-0edae7b87954
[I 23:50:21.920 NotebookApp] Adapting to protocol v5.1 for kernel 6017d44f-6235-466b-9417-c18f22c4697e
[I 23:50:22.057 NotebookApp] Adapting to protocol v5.1 for kernel 92a292d5-9c3d-424d-96b0-0edae7b87954

Everything is still working.

@SimonBiggs
Copy link
Owner

SimonBiggs commented Mar 8, 2018 via email

@DevanR
Copy link

DevanR commented Mar 8, 2018

That works now as well:

(scripted_forms) DEVML0204889:scripted_forms dre09$ scriptedforms quick-start.md
[I 09:39:19.949 ScriptedForms] Serving notebooks from local directory: /Users/dre09/Workspace/github/scripted_forms
[I 09:39:19.949 ScriptedForms] 0 active kernels
[I 09:39:19.949 ScriptedForms] The Jupyter Notebook is running at:
[I 09:39:19.949 ScriptedForms] http://localhost:8888/?token=bac80c351118efed5c88e6bf3d1705490c544c0453e07fa6
[I 09:39:19.949 ScriptedForms] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:39:19.950 ScriptedForms]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=bac80c351118efed5c88e6bf3d1705490c544c0453e07fa6

[I 09:39:20.272 ScriptedForms] Accepting one-time-token-authenticated connection from ::1

@SimonBiggs
Copy link
Owner

Alright :) sounds good to me.

@raiderrobert
Copy link

I have a similar error. Version is scriptedforms==0.6.6

I tried your suggestion from this comment. No difference.

Error: Uncaught (in promise): Error: Invalid response: 403 Forbidden
Error: Invalid response: 403 Forbidden
at new ResponseError (http://localhost:8888/scriptedforms/jupyterlab.js:12:2165)
at http://localhost:8888/scriptedforms/jupyterlab.js:42:434819
at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7588)
at Object.onInvoke (http://localhost:8888/scriptedforms/angular.js:36:1048)
at ZoneDelegate.invoke (http://localhost:8888/scriptedforms/polyfills.js:36:7528)
at Zone.run (http://localhost:8888/scriptedforms/polyfills.js:36:2675)
at http://localhost:8888/scriptedforms/polyfills.js:43:2054
at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8321)
at Object.onInvokeTask (http://localhost:8888/scriptedforms/angular.js:36:950)
at ZoneDelegate.invokeTask (http://localhost:8888/scriptedforms/polyfills.js:36:8242)

@SimonBiggs
Copy link
Owner

Could it be something like opening and closing the terminal after running updates? Could you also try #101 (comment)

@SimonBiggs
Copy link
Owner

SimonBiggs commented Mar 8, 2018

Ahh sorry, I just saw you said you tried that. Can you also verify your version of the notebook package for me?

And if you could also report what browser you're using, and OS.

@SimonBiggs
Copy link
Owner

SimonBiggs commented Mar 8, 2018

And if you could also run jupyter notebook with no config parameters and report what happens when you run that.

@raiderrobert
Copy link

notebook==5.4.0

jupyter notebook starts just fine

@SimonBiggs
Copy link
Owner

What is the terminal output for each of the other two options?

@SimonBiggs
Copy link
Owner

@raiderrobert @ysharoiko were you still having an issue with scriptedforms?

@SimonBiggs
Copy link
Owner

Please comment if you are still having trouble. I would be interested if you also have trouble with the portable version:

https://github.com/SimonBiggs/scriptedforms/releases/download/0.7.1/scriptedforms-0.7.1.zip

I'll close this for now. Will reopen if people still say they are having trouble.

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

No branches or pull requests

4 participants