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

HTTP 500 internal server error: unexpected LEFTBRACKET #80

Open
oberstet opened this issue Jul 10, 2020 · 4 comments
Open

HTTP 500 internal server error: unexpected LEFTBRACKET #80

oberstet opened this issue Jul 10, 2020 · 4 comments

Comments

@oberstet
Copy link

oberstet commented Jul 10, 2020

fwiw, this happens using https://github.com/crossbario/terraform-aws-crossbar :

Bildschirmfoto von 2020-07-11 00-56-53

27.0.0.1 - - [11/Jul/2020 00:56:49] "GET /graph.svg HTTP/1.1" 200 -
[2020-07-11 00:56:50,110] ERROR in app: Exception on /graph.json [GET]
Traceback (most recent call last):
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/blastradius/server/server.py", line 61, in graph_json
    tf = Terraform(os.getcwd())
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/blastradius/handlers/terraform.py", line 67, in __init__
    self.modules[name] = Terraform(directory=self.directory+'/'+source, settings=mod)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/blastradius/handlers/terraform.py", line 26, in __init__
    self.config = hcl.load(config_io)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/hcl/api.py", line 62, in load
    return loads(fp.read(), export_comments=export_comments)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/hcl/api.py", line 81, in loads
    return HclParser().parse(s, export_comments=export_comments)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/hcl/parser.py", line 642, in parse
    return self.yacc.parse(
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/hcl/ply/yacc.py", line 503, in parse
    tok = self.errorfunc(errtoken)
  File "/home/oberstet/cpy382_1/lib/python3.8/site-packages/hcl/parser.py", line 634, in p_error
    raise ValueError(msg)
ValueError: Line 1353, column 41614: unexpected LEFTBRACKET; expected COMMA, IDENTIFIER, STRING, COMMENT, MULTICOMMENT, MINUS, NUMBER, FLOAT, $end, RIGHTBRACE, RIGHTBRACKET, RIGHTPAREN, PERIOD
127.0.0.1 - - [11/Jul/2020 00:56:50] "GET /graph.json HTTP/1.1" 500 -
@oberstet
Copy link
Author

environment:

(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-network-terraform$ python -V
Python 3.8.2
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-network-terraform$ pip show blastradius
Name: BlastRadius
Version: 0.1.23
Summary: Interactive visualizations of Terraform dependency graphs
Home-page: http://pypi.python.org/pypi/BlastRadius/
Author: Patrick McMurchie
Author-email: [email protected]
License: LICENSE.txt
Location: /home/oberstet/cpy382_1/lib/python3.8/site-packages
Requires: pyhcl, jinja2, requests, BeautifulSoup4, Flask
Required-by: 
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-network-terraform$ terraform --version
Terraform v0.12.28
+ provider.aws v2.69.0
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-network-terraform$ 

@brianvoss
Copy link

I'm getting a similar but slightly different error with an identical stack trace.

Stacktrace

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.8/site-packages/blastradius/server/server.py", line 61, in graph_json
    tf = Terraform(os.getcwd())
  File "/usr/local/lib/python3.8/site-packages/blastradius/handlers/terraform.py", line 26, in __init__
    self.config = hcl.load(config_io)
  File "/usr/local/lib/python3.8/site-packages/hcl/api.py", line 62, in load
    return loads(fp.read(), export_comments=export_comments)
  File "/usr/local/lib/python3.8/site-packages/hcl/api.py", line 81, in loads
    return HclParser().parse(s, export_comments=export_comments)
  File "/usr/local/lib/python3.8/site-packages/hcl/parser.py", line 642, in parse
    return self.yacc.parse(
  File "/usr/local/lib/python3.8/site-packages/hcl/ply/yacc.py", line 503, in parse
    tok = self.errorfunc(errtoken)
  File "/usr/local/lib/python3.8/site-packages/hcl/parser.py", line 634, in p_error
    raise ValueError(msg)
ValueError: Line 47, column 1254: unexpected RIGHTBRACE; expected $end, COMMA, IDENTIFIER, STRING, COMMENT, MULTICOMMENT, MINUS, NUMBER, FLOAT```

@brianvoss
Copy link

Environment

Python 3.8.4
~/P/T/terraform-aws-s3 ❯❯❯ pip3 show blastradius
Name: BlastRadius
Version: 0.1.23
Summary: Interactive visualizations of Terraform dependency graphs
Home-page: http://pypi.python.org/pypi/BlastRadius/
Author: Patrick McMurchie
Author-email: [email protected]
License: LICENSE.txt
Location: /usr/local/lib/python3.8/site-packages
Requires: BeautifulSoup4, requests, pyhcl, jinja2, Flask
Required-by:
~/P/T/terraform-aws-s3 ❯❯❯ terraform --version
Terraform v0.12.29
+ provider.aws v2.70.0```

@Jrc356
Copy link

Jrc356 commented Sep 2, 2020

I just made a PR that replaces pyhcl with python-hcl2 and found that it cleared up a bunch of my parsing errors. Could you try this fork and see if this clears it up?

Here's the fork: https://github.com/Jrc356/blast-radius
just clone that guy and run a pip install . in the cloned dir then use as normal

and here's the PR: #84

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