You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
. env/bin/activate; chalice deploy --no-autogen-policy
Updating lambda function...
Regen deployment package...
Sending changes to lambda.
Lambda deploy done.
API Gateway rest API already found.
Deleting root resource id
Done deleting existing resources.
Traceback (most recent call last):
File "/home/chrisgilmerproj/myapp/api/env/bin/chalice", line 11, in<module>
load_entry_point('chalice==0.3.0', 'console_scripts', 'chalice')()
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/cli/__init__.py", line 265, in main
return cli(obj={})
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
returnf(get_current_context(), *args, **kwargs)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/cli/__init__.py", line 175, in deploy
d.deploy(config)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/deployer.py", line 246, in deploy
config)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/deployer.py", line 682, in deploy
return self._create_resources_for_api(config, rest_api_id)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/deployer.py", line 738, in _create_resources_for_api
route_builder.build_resources(url_trie)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/deployer.py", line 298, in build_resources
current['resource_id'], current['route_entry'].methods)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/chalice/deployer.py", line 916, in create_preflight_method
authorizationType='NONE',
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/botocore/client.py", line 159, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/home/chrisgilmerproj/myapp/api/env/local/lib/python2.7/site-packages/botocore/client.py", line 494, in _make_api_call
raise ClientError(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (ConflictException) when calling the PutMethod operation: Method already exists for this resourcemyapp
This is because of the OPTIONS method you have called out in your methods=[...]. When cors=True, we automatically inject an OPTIONS method to support preflight requests. This will cause the error because we'll also try to create another OPTIONS method the points to your view function.
If you don't need the OPTIONS method, the simplest fix would be to remove it from your methods=[].
That error message should be better though.
jamesls
added a commit
to jamesls/chalice
that referenced
this issue
Oct 24, 2016
You'll get an error message from API gateway about a conflict
exception which isn't that helpful. By adding it to the
validation step here, we get a much clearer error message:
```
ValueError: Route entry cannot have both cors=True and
methods=['OPTIONS', ...] configured. When CORS is enabled, an OPTIONS
method is automatically added for you. Please remove 'OPTIONS' from the
list of configured HTTP methods for: /badview
```
Closesaws#142.
When I use the new CORS settings I get an error. Here is my method:
Gives me this error when I deploy:
When I turn off CORS like this:
It totally works.
I just wanted to report this in case you knew of an easy fix. I'll provide more info if it will help.
The text was updated successfully, but these errors were encountered: